-
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
quarkus-hibernate-orm - lazy loading of parameterized attributes from MappedSuperclass with getter does not work. #40719
Comments
Hey @mapuci ; thanks for reporting. IIRC WildFly doesn't enable bytecode enhancement by default, so I don't think the WildFly reproducer is relevant. Are you able to reproduce your issue in this test? https://github.com/hibernate/hibernate-test-case-templates/blob/main/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/QuarkusLikeORMUnitTestCase.java If so, that's a bug in Hibernate ORM and we should fix it there. If not, it's indeed a bug in Quarkus itself. |
Hi @yrodiere thank you for the reply. About But, results should be identical. I will try to reproduce the issue with test mentioned above, I will let you know what I find. |
Hey @yrodiere hibernate/hibernate-test-case-templates#387 I think that piece of code is cool. :) I'm closing this issue, because it's not quarkus related. |
Thanks a lot @mapuci! |
Describe the bug
Reproducer: https://github.com/mapuci/hibernate-parameterized-mappedsuperclass
quarkus
wildfly
I believe reading the simple reproducer code offers the best explanation.
thisWillFail
hibernate_interceptor
does not get invoked when calling getter ofparameterized entity field, inside abstract MappedSuperClass
If you have read the code and README, stop reading.
We have entity and its abstract parameterized MappedSuperclass:
After these entities are enhanced by bytebuddy/hibernate, invoking getters for parameterized field (e.g.
one.getTwo()
) do not invoke$$_hibernate_getInterceptor()
, so the relation is not lazily fetched.Works as expected in latest wildfly.
Expected behavior
Hibernate interceptor is invoked, triggering lazy load.
Actual behavior
No response
How to Reproduce?
clone https://github.com/mapuci/hibernate-parameterized-mappedsuperclass
here you will find quarkus reproducer AND wildfly project, with same entities working normally.
With some of my additional insights in readme. :)
To reproduce, change directory to
quarkus3-hibernate-parameterized-mappedsuperclass
and run./mvnw test
.Output of
uname -a
orver
Darwin Matejs-MacBook-Pro-2.local 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 arm64
Output of
java -version
17 (tried with 21 also)
Quarkus version or git rev
3.10.1 (I also tried 2.0.3.Final, 3.2.0.Final, 3.8.0)
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.6
Additional information
No response
The text was updated successfully, but these errors were encountered: