From: Assaf B. (JIRA) <no...@at...> - 2006-07-04 15:02:57
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1525?page=comments#action_23532 ] Assaf Berg commented on HHH-1525: --------------------------------- I think there's another scenario that arises from this problem. Say you have a common class C which is refrenced both from A and B. A is considered the owner of C so it has a cascade="save-update" to C, while B has cascade="none" and not-null="true". Now if I'm saving an instance of A with a new C instance, and want to create a reference to that same instance of C from B, i'll have to force a session flush first before saving B or I get an exception. I would like the checks done when saving B to wait until A is actually saved (i.e. flushed). Or if it is not done in the same order I called save, at least check all associations with cascades before associations without... > multiple cascades to the same transient instance within a single object graph > ----------------------------------------------------------------------------- > > Key: HHH-1525 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1525 > Project: Hibernate3 > Type: Improvement > Components: core > Reporter: Steve Ebersole > Assignee: Steve Ebersole > > > Consider an object graph being saved that contains the same transient instance multiple times (at diffierent levels in the graph) where some of the associations define cascading and some do not and that the associations without cascading are further defined as not-null. Based on the order in which the associations are cascaded there is a potential for that transient instance to cause an "unsaved transient instance" exception if the non-cascaded and not-null association is cascaded to first, even though a subsequent cascaced would in fact cause the instance to become managed. > Typically this is easy enough to work around by simply reordering the associations in the mapping so that the cascaded association is before the non-cascaded one. However, this is not always possible (the case of inheritence hierarchies comes to mind, where the superclass associations are always cascaded to first). -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |