This projects demonstrates
- quarkus specific problems regarding lazy loading of parameterized associated entities from @Mapped superclass.
- hibernate problem with constructing String based fetchGraph with GraphParser. Also with parameterized associated entities from @Mapped superclass.
- quarkus3-hibernate-parameterized-mappedsuperclass
- here you can reproduce the problem.
- Simply run the test. (We all know how to do that)
- I checked the generated bytecode (local build of hibernate lib, changed DEBUG = true in ByteBuddyState class.)
- see enhancedClasses dir. It looks fine to me - using decompiler.
- wildfly_hibernate here you can see the same functionality working normally.
- The project is clone of wildfly quickstart for hibernate
- https://github.com/wildfly/quickstart/tree/main/hibernate
- I only added some code in the reproducer package, including entities, copied from quarkus app.
- See ReproducerRepo
- It is invoked every time you refresh page page
- I ran and deployed WF with provisioned_server profile. With Intellij.
- run mvn clean package -P provisioned_server inside wildfly-hibernate directory (this builds WAR and wildfly)
- create new run config for local wildfly, it is installed in /target/server.
- NOTE: I didn't export enhanced entity classes with wildfly. (yet)
- see decompiled classes HERE
- call to getter
one.getTwo()
triggers code in AbsOne
public TWO getTwo() {
return this.$$_hibernate_read_two();
}
public AbsTwo $$_hibernate_read_two() {
return this.two;
}
But the method $$_hibernate_read_two is overridden
inside One
public Two $$_hibernate_read_two() {
if (this.$$_hibernate_getInterceptor() != null) {
super.$$_hibernate_write_two((AbsTwo)this.$$_hibernate_getInterceptor().readObject(this, "two", super.$$_hibernate_read_two()));
}
return (Two)super.$$_hibernate_read_two();
}
But this overridden method is never called.
you can see, that overriding of methodone.getAbsOneStringProp
works as expected... entity two
and three
are correctly lazy loaded.