java - Why hibernate delete relationship after parent refresh? -
@table(name = "parent") @entity public class parent implements serializable { @onetoone(cascade = cascadetype.all, mappedby = "parent") private child child; } @table(name = "child") @entity public class child implements serializable { private parent parent; }
next use org.springframework.orm.hibernate3.hibernatetemplate
find parent collection criteria works, when call:
list<parent> parents = hibernatetemplate.findbycriteria(...) (parent p: parents) { //here p.getchild() return child object hibernatetempalte.refresh(parent); //here p.getchild() null }
so question why getchild()
became nul after parent refresh? note null persisted database andonetoone relationship became broken.
hibernate version 3.6.9
Comments
Post a Comment