-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance #41198
Comments
/cc @geoand (kotlin) |
cc @yrodiere |
Thanks for reporting. I see you're using Hibernate Reactive, but given the nature of the problem, it's more likely a Hibernate ORM issue. The Kotlin part makes me uneasy; I suspect your Can you reproduce this with https://github.com/hibernate/hibernate-test-case-templates/blob/main/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/QuarkusLikeORMUnitTestCase.java? Ideally in pure Java? If so, I would suggest reporting directly through Hibernate's Jira instance, and leaving a link to that Jira here. |
Thank you @yrodiere for the quick reply. Will try it out with pure Java. |
@yrodiere I have refactored the code to Java, and it looks like the issue occured when I read an entity first before updating it. Strangely, switching back to Quarkus v3.10.2 will make both tests run successfully. |
Thanks @beiertu-mms . So, from what I see in your reproducer, this is how things go wrong:
This actually looks like a bug in Hibernate Reactive... I wouldn't expect a new persistent collection to be created in case of @DavideD can you please confirm and file a bug upstream? EDIT: Also, this is not specific to Kotlin. |
Yes, it looks like a bug. |
does not seem explicitly problem in hibernate-reactive, problem occurs in traditional-hibernate too
|
Similar issue on Hibernate ORM -- perhaps the same root cause, perhaps not -- https://hibernate.atlassian.net/browse/HHH-18389. On Quarkus: #7462 |
I am experiencing a comparable or identical issue. Following the upgrade from Spring Boot 3.2.x to 3.3.x, I encountered the following problem: org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance. Hibernate ORM core version 6.5.2.Final |
I reverted to Hibernate version 6.4.9 Final, and now it is functioning correctly again. FYI @yrodiere |
This seems to have been fixed with Quarkus version >= |
Describe the bug
We have a the following one-to-many entities
Up until Quarkus
v3.10.2
, adding new PostComment to a Post works based on the test here.But when updating the version to
>=3.11.0
, we got the errorA collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance
(github action's log).Expected behavior
No exceptions are thrown when adding and persisting a new item to a bidirectional OneToMany entities.
Actual behavior
Full logs
How to Reproduce?
Output of
uname -a
orver
Linux 6.9.4-arch1-1 x86_64 GNU/Linux
Output of
java -version
openjdk version "22" 2024-03-19
Quarkus version or git rev
3.11.2
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Additional information
No response
The text was updated successfully, but these errors were encountered: