-
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
Access to public field returns null for Hibernate entity lazy-loaded from polymorphic toOne association #8932
Comments
looks like lazy load is not getting triggered when the entity is annotated with: |
@gsmet thanks for the quick reply. I have attached a simple maven project to demonstrate the issue. download, extract, and run the project: then run the curl: you'll get the following message: in the quarkus console, you'll notice that lazy load was never triggered on the "Content" entity:
working as expected if I remove the following line from the "Content" entity:
curl command returns: and we get the following in the quarkus console output:
please let me know if you need more details to troubleshoot. Thanks! |
still experiencing the same issue in release 1.10.5.Final. we did find a workaround by manually define the getters and setters on entities in the inheritance hierarchy:
Hope this helps. |
Maybe related to this Hibernate-Bug? |
I was able to reproduce the problem on Quarkus 2.7.2.Final with @jrongs 's reproducer (thanks for that!). Removing the I'll try to find out where the problem comes from exactly. |
The problem appears to be in Hibernate ORM itself. I created https://hibernate.atlassian.net/browse/HHH-15090 and will handle this upstream. EDIT: As it turns out, there is also a problem in Quarkus: proxy classes are generated before we add getter/setter methods for the public fields, which means those getter/setter methods are not intercepted by the proxy, and as a result they do not trigger initialization... I'll need to address that, too. |
Describe the bug
Since release 1.3.2.Final, I noticed hibernate lazy load is no long working properly in my project. here is the hierarchy of the entities:
c.b.a is null, because c.b is a hibernate proxy and it is not getting lazy loaded. everything worked fine before 1.3.2.Final.
Expected behavior
Hibernate lazy load works for all entities.
Actual behavior
Hibernate lazy load not working for entities annotated with Inheritance
To Reproduce
see description above.
Configuration
Environment (please complete the following information):
uname -a
orver
: Linux orchid 4.15.0-96-generic Fix circularity detection and add a test #97-Ubuntu SMP Wed Apr 1 03:25:46 UTC 2020 x86_64 x86_64 x86_64 GNU/Linuxjava -version
: java 11.0.1 2018-10-16 LTSmvnw --version
orgradlew --version
): Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)The text was updated successfully, but these errors were encountered: