[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5559?page=c...
]
Yona Appletree commented on HHH-5559:
-------------------------------------
I would like to cast my vote for this issue as well. We have a similar data model to what
Koen indicated -- we have objects that represent a tree that in some cases becomes
obsolete, and must be re-generated. Currently, we must either explicitly remove the
orphaned entity or first set the reference to it to null, then persist the parent, then
set the reference to the new entity.
I'm wondering if this slip has been forgotten, as it was closed as "Won't
Fix" and hasn't been touched in four months. If so, perhaps a new slip should be
created? I think this issue is a nasty hole in the generally very well implemented orphan
deletion functionality, which really makes building models much easier.
JPA 2 orphanRemoval on OneToOne relation does not work properly
---------------------------------------------------------------
Key: HHH-5559
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5559
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.0.Beta-1, 3.5.0-Beta-2, 3.5.0-Beta-3, 3.5.0-Beta-4, 3.5.0-CR-1,
3.5.0-CR-2, 3.5.0-Final, 3.5.1, 3.5.2, 3.5.3, 3.5.4, 3.6.0.Beta1, 3.6.0.Beta2, 3.5.5,
3.6.0.Beta3, 3.6.0.Beta4
Environment: Hibernate 2.5 (tested with 3.5.4)
Reporter: loic descotte
Assignee: Emmanuel Bernard
Attachments: HHH-5559-JPA2-orphanRemoval-on-OneToOne-testcase-revised.patch,
HHH-5559-JPA2-orphanRemoval-on-OneToOne-testcase.patch
I have an class A with a oneToRelation with a classe B :
@Entity
public class A{
@OneToOne(cascade = {CascadeType.ALL}, orphanRemoval=true)
B b;
...
}
If i do this :
A a = new A();
B b1 = new B();
a.setB(b1);
em.persist(a);
B b2 = new B();
a.setB(b2);
em.update(a);
As b1 become an orphan, Hibernate should remove it from the database. But it still
remains in the DB.
--
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