Hi all!
I need to persist a deeply nested object graph (5-6 levels). Objects in some levels could have been already persisted while others are new to the session. With hibernate 2.x I did a saveOrUpdateCopy() of the graph. According to the
migration guide I should do a merge() with hibernate 3.x. But the fact is that for cases as A--*B--*C (say, A is the parent of Bs which in turn are the parents of Cs, the relationships are all bidirectional associations and cascades=all...as in chaper 22) won't work. Because if B and C are new to the session, as B in not attached to it by merge(), hibernate will complaint that the (to-parent) reference from C to B is one to a non-persisted object.
How can I get the old saveOrUpdateCopy() behaviour back?
Thank you in advance.
Regards,
Carlos
|