Andrea Boriero (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYzczZWM0Nzcz...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16322?atlOrigin=eyJpIjoiYzczZW...
) HHH-16322 (
https://hibernate.atlassian.net/browse/HHH-16322?atlOrigin=eyJpIjoiYzczZW...
) Merge of entities having a collection with orphanRemoval true fails when bytecode
enhancement is enabled (
https://hibernate.atlassian.net/browse/HHH-16322?atlOrigin=eyJpIjoiYzczZW...
)
Change By: Andrea Boriero (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
given
{noformat}@Entity(name = "parent")
@Table(name = "parent")
public static class Parent {
@Id
private Long id;
@OneToMany(mappedBy = "parent", cascade = { MERGE }, orphanRemoval = true, fetch
= FetchType.LAZY)
private List<Child> children = new ArrayList<>();
}
@Entity
@Table(name = "child")
public static class Child {
@Id
private Long id;
@ManyToOne(fetch = FetchType.LAZY)
private Parent parent;
}{noformat}
the following
{code:java}inTransaction(
session -> {
Parent parent = new Parent();
parent = session.merge( parent );
Child child = new Child();
child = session.merge( child );
parent.addChild( child );
}
);{code}
causes
{code:java}org.hibernate.HibernateException: A collection with
cascade="all-delete-orphan" was no longer referenced by the owning entity
instance: Parent.children{code}
(
https://hibernate.atlassian.net/browse/HHH-16322#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16322#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100217- sha1:d601792 )