[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4626) OneToMany cascadeType.ALL change collection and merge - does not remove entities

Dave (JIRA) noreply at atlassian.com
Tue Dec 1 00:17:08 EST 2009


OneToMany cascadeType.ALL  change collection and merge - does not remove entities
---------------------------------------------------------------------------------

                 Key: HHH-4626
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4626
             Project: Hibernate Core
          Issue Type: Bug
          Components: entity-manager
    Affects Versions: 3.3.1
         Environment: JBoss 5.1.0.GA,  FC 10, Java 1.6
            Reporter: Dave


public Class Foo {

@OneToMany(fetch=FetchType.LAZY, cascade={CascadeType.ALL}, mappedBy="foo")
public List<Bar> getBars() {
 return bars;
}

}

// aFoo is persited
Foo aFoo = ...
aFoo.getBars().remove(0);  // remove the first
aFoo.getBars().add(aBar);  // add new one
em.merge(aFoo);

For cascade={CascadeType.ALL}, it works for creating/deleting aFoo. 
For merge, the new aBar is created, but the bar that was removed from collection are not deleted from persistence.


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