From: <no...@at...> - 2005-07-23 20:43:14
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HHH-785 Here is an overview of the issue: --------------------------------------------------------------------- Key: HHH-785 Summary: Persistence through cascading should have higher precedence than orphan-delete Type: Improvement Status: Unassigned Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate3 Components: core Versions: 3.1 beta 1 Assignee: Reporter: Christian Bauer Created: Sat, 23 Jul 2005 3:42 PM Updated: Sat, 23 Jul 2005 3:42 PM Description: A typical tree mapped using an adjacency list: <many-to-one name="parent" cascade="none"/> <set name="children" cascade="all, delete-orphan"/> A normal tree operation is moving a node: a.remove(b); c.add(b); This results in an exception, as Hibernate currently rates the delete-orphan as more important and warns that the node would become persistent again through cascading. However, this is the only way to implement relocation of a node in a tree without resorting to complex session coding. I argue that the "delete orphans" guarantee given in the mapping should not have precedence over the the actual non-orphaned persistent state in the Session. --------------------------------------------------------------------- JIRA INFORMATION: 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 If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <no...@at...> - 2005-07-23 20:43:15
|
The following issue has been updated: Updater: Christian Bauer (mailto:chr...@hi...) Date: Sat, 23 Jul 2005 3:42 PM Changes: Component changed to core --------------------------------------------------------------------- For a full history of the issue, see: http://opensource.atlassian.com/projects/hibernate/browse/HHH-785?page=history --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HHH-785 Here is an overview of the issue: --------------------------------------------------------------------- Key: HHH-785 Summary: Persistence through cascading should have higher precedence than orphan-delete Type: Improvement Status: Unassigned Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate3 Components: core Versions: 3.1 beta 1 Assignee: Reporter: Christian Bauer Created: Sat, 23 Jul 2005 3:42 PM Updated: Sat, 23 Jul 2005 3:42 PM Description: A typical tree mapped using an adjacency list: <many-to-one name="parent" cascade="none"/> <set name="children" cascade="all, delete-orphan"/> A normal tree operation is moving a node: a.remove(b); c.add(b); This results in an exception, as Hibernate currently rates the delete-orphan as more important and warns that the node would become persistent again through cascading. However, this is the only way to implement relocation of a node in a tree without resorting to complex session coding. I argue that the "delete orphans" guarantee given in the mapping should not have precedence over the the actual non-orphaned persistent state in the Session. --------------------------------------------------------------------- JIRA INFORMATION: 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 If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <no...@at...> - 2005-07-23 21:43:22
|
The following comment has been added to this issue: Author: Christian Bauer Created: Sat, 23 Jul 2005 4:03 PM Body: Actually, my example of "moving" wasn't entirely complete, because I obviously wouldn't need orphan-delete for this enabled at all. The problem is I'd still like to have it for a simple delete of a node. --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HHH-785?page=comments#action_19006 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HHH-785 Here is an overview of the issue: --------------------------------------------------------------------- Key: HHH-785 Summary: Persistence through cascading should have higher precedence than orphan-delete Type: Improvement Status: Unassigned Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate3 Components: core Versions: 3.1 beta 1 Assignee: Reporter: Christian Bauer Created: Sat, 23 Jul 2005 3:42 PM Updated: Sat, 23 Jul 2005 4:03 PM Description: A typical tree mapped using an adjacency list: <many-to-one name="parent" cascade="none"/> <set name="children" cascade="all, delete-orphan"/> A normal tree operation is moving a node: a.remove(b); c.add(b); This results in an exception, as Hibernate currently rates the delete-orphan as more important and warns that the node would become persistent again through cascading. However, this is the only way to implement relocation of a node in a tree without resorting to complex session coding. I argue that the "delete orphans" guarantee given in the mapping should not have precedence over the the actual non-orphaned persistent state in the Session. --------------------------------------------------------------------- JIRA INFORMATION: 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 If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <no...@at...> - 2005-08-11 22:13:01
|
Message: The following issue has been closed. Resolver: Gavin King Date: Thu, 11 Aug 2005 5:11 PM Unfortunately, this would be very, very difficult to implement. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HHH-785 Here is an overview of the issue: --------------------------------------------------------------------- Key: HHH-785 Summary: Persistence through cascading should have higher precedence than orphan-delete Type: Improvement Status: Closed Priority: Major Resolution: WON'T FIX Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate3 Components: core Versions: 3.1 beta 1 Assignee: Reporter: Christian Bauer Created: Sat, 23 Jul 2005 3:42 PM Updated: Thu, 11 Aug 2005 5:11 PM Description: A typical tree mapped using an adjacency list: <many-to-one name="parent" cascade="none"/> <set name="children" cascade="all, delete-orphan"/> A normal tree operation is moving a node: a.remove(b); c.add(b); This results in an exception, as Hibernate currently rates the delete-orphan as more important and warns that the node would become persistent again through cascading. However, this is the only way to implement relocation of a node in a tree without resorting to complex session coding. I argue that the "delete orphans" guarantee given in the mapping should not have precedence over the the actual non-orphaned persistent state in the Session. --------------------------------------------------------------------- JIRA INFORMATION: 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 If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: Thom P. (JIRA) <no...@at...> - 2006-03-22 15:23:16
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-785?page=comments#action_22560 ] Thom Pischke commented on HHH-785: ---------------------------------- A pity. I can imagine why this would be very difficult to implement, but it'd be fantastic if Hibernate were someday able to handle moving a child to a new parent without needing to resort to handling deletion of orphans manually. We have many examples in our code where we move a child to a new parent. In our case, we do a lot of modification of detached entities. When the time comes to save all the changes (User hits 'Save' button), then we start a Session/Transaction and 'update' the model object to reattach it to the Session and write all the changes to disk. These updates include both removal (deletion) of objects, and transferral of objects to new parents. Since many such changes can accumulate outside the scope of a Session, manual handling of orphan deletion would be very difficult, since we would essentially need to query the database after writing all the changes to manually find all orphaned objects. Not even sure that would be possible, since we would get exceptions if the parent were ever deleted, since the foreign key constraints of the children would be violated. Our workaround for all this is simply to clone the children which need to be moved to new parents, resulting in the original child being deleted, and a new identical child being persisted, but with a different parent. Of course, this is inelegant, inefficient and results in quite an accumulation of clones, since we also have to store 'undo' information for each movement of the child. Anyway, probably you're sighing and thinking 'What the hell does this guy think he's doing?', but I thought it might be useful to someone if I added our use-case to this issues discussion. > Persistence through cascading should have higher precedence than orphan-delete > ------------------------------------------------------------------------------ > > Key: HHH-785 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-785 > Project: Hibernate3 > Type: Improvement > Components: core > Versions: 3.1 beta 1 > Reporter: Christian Bauer > > > A typical tree mapped using an adjacency list: > <many-to-one name="parent" cascade="none"/> > <set name="children" cascade="all, delete-orphan"/> > A normal tree operation is moving a node: > a.remove(b); > c.add(b); > This results in an exception, as Hibernate currently rates the delete-orphan as more important and warns that the node would become persistent again through cascading. However, this is the only way to implement relocation of a node in a tree without resorting to complex session coding. I argue that the "delete orphans" guarantee given in the mapping should not have precedence over the the actual non-orphaned persistent state in the Session. -- 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 |
From: Aaron D. (JIRA) <no...@at...> - 2006-07-11 12:27:02
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-785?page=comments#action_23594 ] Aaron Digulla commented on HHH-785: ----------------------------------- Note: In HHH-1894, I have a much more simple case which is inside a transation, using non-detached objects and there, it doesn't work as well. A pity. > Persistence through cascading should have higher precedence than orphan-delete > ------------------------------------------------------------------------------ > > Key: HHH-785 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-785 > Project: Hibernate3 > Type: Improvement > Components: core > Versions: 3.1 beta 1 > Reporter: Christian Bauer > > > A typical tree mapped using an adjacency list: > <many-to-one name="parent" cascade="none"/> > <set name="children" cascade="all, delete-orphan"/> > A normal tree operation is moving a node: > a.remove(b); > c.add(b); > This results in an exception, as Hibernate currently rates the delete-orphan as more important and warns that the node would become persistent again through cascading. However, this is the only way to implement relocation of a node in a tree without resorting to complex session coding. I argue that the "delete orphans" guarantee given in the mapping should not have precedence over the the actual non-orphaned persistent state in the Session. -- 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 |