-
Notifications
You must be signed in to change notification settings - Fork 583
4.x: Tests fail when upgrading to Hibernate 6.6.23.Final #10441 #10487
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
base: main
Are you sure you want to change the base?
Conversation
72419d5
to
cef1fa2
Compare
I want to be careful here; I think it should be possible to merge a detached entity according to the spec. Specifically, the spec says:
Then, recently, Hibernate says:
Indeed, merging a detached entity X when there is no "pre-existing managed entity instance X'" should result in an |
Thanks @ljnelson , does it make sense that you open them an issue to discuss this?. |
Native image fails consistently:
|
5a51266
to
ad0497f
Compare
e23022b
to
0d6d1a7
Compare
a3670af
to
1a03467
Compare
…0441 Signed-off-by: Jorge Bescos Gascon <[email protected]>
It is passing now |
] | ||
}, | ||
{ | ||
"name": "org.hibernate.event.spi.PostUpsertEventListener[]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jbescos such metadata should be unnecessary if you use the Hibernate provided GraalVM module?
-https://github.com/hibernate/hibernate-orm/blame/main/hibernate-graalvm/src/main/java/org/hibernate/graalvm/internal/StaticClassLists.java#L68
I created that module to simplify such integrations by other frameworks, please let us know if it's not useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this file we tell GraalVM what classes should be available for reflection at runtime. I added that because GraalVM told me to do so.
We don't have org.hibernate.orm:hibernate-graalvm
as dependency, but I have added it and the test fails, with and without this configuration. It compiles well, but in runtime I am having some ClassNotFoundExceptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this file we tell GraalVM what classes should be available for reflection at runtime. I added that because GraalVM told me to do so.
I understand, but it makes more sense to have the rules which are specific to a library to be maintained by the library - otherwise you'll need to make changes for each new Hibernate release.
So for that reason I had created the hibernate-graalvm
module.
We don't have org.hibernate.orm:hibernate-graalvm as dependency, but I have added it and the test fails, with and without this configuration.
Such features need to be activated
Args=-H:ReflectionConfigurationResources=${.}/reflect-config-additional.json | ||
Args=-H:ReflectionConfigurationResources=${.}/reflect-config-additional.json \ | ||
-H:ClassInitialization=org.hibernate.bytecode.enhance.internal.bytebuddy.ByteBuddyEnhancementContext:run_time \ | ||
-H:ClassInitialization=org.hibernate.proxy.pojo.bytebuddy.ByteBuddyProxyHelper:run_time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern would be that this is going to fail at runtime. Just hiding / postponing problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use static enhancement, so bytebuddy related things should not be executed. This args allows me to replace the static fields that are triggering reflection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand - but the compiler is usually right, it's running a formal proof. So if it's including it, this would suggest that there are some corner cases in which this code is necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding --trace-class-initialization
only shows the stack traces I printed here. It starts with ByteBuddyEnhancementContext
and ByteBuddyProxyHelper
. We cannot know more about why are that static fields loaded.
We already have a lot of GraalVM configuration related to Hibernate here and some other methods substitutions here. I was not part of this, but it seems this integration was not easy.
Description
Resolves #10441
Hibernate 6.6 cannot attach a removed entity:
https://docs.jboss.org/hibernate/orm/6.6/migration-guide/migration-guide.html#merge-versioned-deleted