J. Gremmen (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZDUxYjMzOTBl...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16756?atlOrigin=eyJpIjoiZDUxYj...
) HHH-16756 (
https://hibernate.atlassian.net/browse/HHH-16756?atlOrigin=eyJpIjoiZDUxYj...
) orphanRemoval does not work when bytecode enhancement is enabled (
https://hibernate.atlassian.net/browse/HHH-16756?atlOrigin=eyJpIjoiZDUxYj...
)
Issue Type: Bug Affects Versions: 5.6.15 Assignee: Unassigned Components:
bytecode-enhancement, hibernate-core Created: 06/Jun/2023 05:27 AM Environment:
hibernate-core 5.6.15.Final, Java 8, Oracle
Gradle config:
hibernate {
enhance {
enableLazyInitialization = true
enableDirtyTracking = true
// association management has strange side effects; keep it disabled!
enableAssociationManagement = false
}
} Priority: Major Reporter: J. Gremmen (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
Our project has the following construct in use in various places:
@Entity
@Table
@DynamicInsert
@DynamicUpdate
@Getter
public class Workorder implements Serializable {}
...
@OneToOne(fetch = LAZY, cascade = ALL, orphanRemoval = true, mappedBy =
"workorder")
@LazyToOne(NO_PROXY) @LazyGroup("caring-workorder")
@Fetch(SELECT)
protected AdditionalCaring caringWorkorder;
...
}
If bytecode enhancement is enabled, orphanRemoval does not work. If in this case
caringWorkorder had an associated entity and it is set to null, Hibernate does not delete
the entry from the table associated with AdditionalCaring.
This problem occurs both with unidirectional and bidirectional 1:1 associations.
It would be helpful to know - for the time being - if there’s a workaround for this
problem.
(
https://hibernate.atlassian.net/browse/HHH-16756#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16756#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#100225- sha1:3b7cdab )