[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2373) Merging a persistent object leads to cascading failure in collections

Emmanuel Bernard (JIRA) noreply at atlassian.com
Sun Jan 21 19:13:44 EST 2007


Merging a persistent object leads to cascading failure in collections
---------------------------------------------------------------------

         Key: HHH-2373
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2373
     Project: Hibernate3
        Type: Bug

  Components: core  
    Versions: 3.2.1    
    Reporter: Emmanuel Bernard


class Empire {
   ...
   @OneToMany(cascade.ALL)
   public Set<Colony> colonies;
}


Then 

roman = (Empire) em.get( Empire.class, roman.getId() );
Colony gaule = new Colony();
roman.getColonies().add(gaule);
em.merge( roman ); //If commented, will work
em.flush();
em.clear();
roman =(Empire) em.get(Empire.class, roman.getId() );
assertEquals( 1, roman.getColonies().size() );


I believe the issue is about having a persistent copy of gaule (according to the merge API), not part of roman.getColonies() (colonies containing the transient gaule object)

-- 
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




More information about the hibernate-issues mailing list