[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4626?page=c...
]
Hardy Ferentschik updated HHH-4626:
-----------------------------------
Description:
{code}
public Class Foo {
@OneToMany(fetch=FetchType.LAZY, cascade={CascadeType.ALL}, mappedBy="foo")
public List<Bar> getBars() {
return bars;
}
}
{code}
{code}
// aFoo is persited
Foo aFoo = ...
aFoo.getBars().remove(0); // remove the first
aFoo.getBars().add(aBar); // add new one
em.merge(aFoo);
{code}
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.
was:
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.
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
Assignee: Hardy Ferentschik
Fix For: 3.6
{code}
public Class Foo {
@OneToMany(fetch=FetchType.LAZY, cascade={CascadeType.ALL}, mappedBy="foo")
public List<Bar> getBars() {
return bars;
}
}
{code}
{code}
// aFoo is persited
Foo aFoo = ...
aFoo.getBars().remove(0); // remove the first
aFoo.getBars().add(aBar); // add new one
em.merge(aFoo);
{code}
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira