-
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 JPA does not seem to apply EntityGraph hints #12980
Comments
/cc @Sanne |
@dhoffer could you prepare a minimal reproducer in the form of a Maven project? |
@gsmet Unfortunately I don't know how to do that, my project is huge and assumes the DB exists/etc. |
@dhoffer There is a simple hibernate-orm quickstart that could be extended rather easily: https://github.com/quarkusio/quarkus-quickstarts/tree/master/hibernate-orm-quickstart |
@famod I am attempting to produce the reproducer starting with the quickstart you mentioned. Not there yet, but trying. |
@famod @gsmet Here is what it takes to reproduce this issue:
Per your suggestion I have modified the hibernate-orm-quickstart module to do the above and I changed the single test to test the above with a failing unit test. I forked to the following. Should I create a PR for you to see changes? What is the best way to show you the new code & failing test? https://github.com/dhoffer/quarkus-quickstarts I created quarkusio/quarkus-quickstarts#704 so you can see a reproducer. The bug is that quarkus.hibernate-orm.fetch.batch-size should have no effect on the hint provided and corresponding optimized join select statement. |
@Sanne this looks like an issue in Hibernate ORM? I don't see how it could be Quarkus-related? |
I investigated ending up with the following two discoveries:
|
@NathanQingyangXu I confirm we enforce the padded batching in Quarkus. |
Ticket was created here: https://hibernate.atlassian.net/browse/HHH-14312. |
Our entities use JPA @NamedEntityGraph to provide JPA hints on what should be included in the queries. Quarkus appears to be ignoring these hints so the query does not contain all the expected data. This causes LazyInitializationException to be thrown during object serialization because the data was not included in the fetch.
Here is an example of the entities.
Here is an example of the JPA query using the above EntityGraph.
Quarkus v1.8.3.Final
openjdk 11.0.8 2020-07-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.8+10, mixed mode)
The text was updated successfully, but these errors were encountered: