-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Unable to use dynamic named queries on hibernate-orm #36441
Comments
Hello, Thanks for reporting. It would help a lot if your could please provide a self-contained reproducer, i.e. a Quarkus project that attempts to do this and should work, but does not. |
Hey, Did you have time to work on a reproducer? |
Hello. My apologies for not having submitted a reproducer - I will try to generate one until the end of the week. Cheers |
Hey @i96751414, any news on that reproducer? Thanks. |
Apologies for the delay in creating the reproducer. |
Thank you @i96751414 , we will have a look. |
So... this seems to be a bug in Hibernate ORM itself: https://hibernate.atlassian.net/browse/HHH-17566 I think you could work around the problem by using non-native (HQL) queries. |
To clarify, I reported the bug to the Hibernate ORM team and we'll wait for it to be solved upstream. Thanks for reporting! |
Describe the bug
Hello,
I just realised it is not possible to use typed queries (where the result class is an entity - annotated with @entity) for named queries which are created dynamically (using hibernate-orm).
When using the below approach:
entityManager.getEntityManagerFactory().addNamedQuery("name", entityManager.createNativeQuery("sql string", ResultClassEntity.class));
and then getting the created query through:
entityManager.createNamedQuery("name", ResultClassEntity.class)
the following exception is thrown:
java.lang.IllegalArgumentException: Named query exists, but did not specify a resultClass
Kindly
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
No response
Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: