Michał Sobkiewicz (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HHH-15734 (
https://hibernate.atlassian.net/browse/HHH-15734?atlOrigin=eyJpIjoiZDExZm...
)
Re: orphanRemoval: Hibernate deletes entity if moved to freshly added parent (
https://hibernate.atlassian.net/browse/HHH-15734?atlOrigin=eyJpIjoiZDExZm...
)
It seems that you are correct. I drew wrong conclusions from the fact, that EclipseLink
was able to handle my use case.
The orphanRemoval functionality is intended for entities that are
privately “owned” by their parent entity. Portable applications must
otherwise not depend upon a specific order of removal, and must not
reassign an entity that has been orphaned to another relationship or
otherwise attempt to persist it.
(
https://jakarta.ee/specifications/persistence/3.1/jakarta-persistence-spe...
)
Please note, that the current behavior can be a little bit surprising (even if it is
unspecified!). I would be certainly less confused if either both of the following
operation succeed or both fail (by throwing exception?):
1. moving managed node “x” from managed node “a” to managed node “b”,
2. inserting transient node “x” between managed node “a” and managed node “b”.
Currently, operation 1. is doable and works as expected (at least by some people! ). At
the same time, operation 2. fails miserably yet silently.
It’s more than sure that some Hibernate users already depend on 1., so it’s likely not an
option to change anything here (or is it?). However, if you can, please consider
supporting operation 2. too. Implementation will appear to be more consistent, at least in
my opinion.
Thanks again!
(
https://hibernate.atlassian.net/browse/HHH-15734#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15734#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#100227- sha1:28a616e )