-
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
NamedQuery inside repository #40987
Comments
I think this is just a documentation problem, right @FroMage? |
Looking at the processor code, it appears that indeed it's a documentation issue, we only look at named queries on the entities and their hierarchy. |
I think, perhaps, that "being the Panache entity class, or the repository parameterized type" means "the panache entity, or the type argument to the repository" but that's not clear at all, I'll delete that part. |
PR done #41053 |
Spring provides a possibility to specify queries inside repositories:
Would be good to have something similar in quarkus |
We are working on type-safe queries for Hibernate in Quarkus. |
Fixes quarkusio#40987 (cherry picked from commit bdd407c)
Fixes quarkusio#40987 (cherry picked from commit bdd407c)
Describe the bug
According to the documentation it is possible to define a @NamedQuery at entity's repository
Named queries can only be defined inside your Jakarta Persistence entity classes (being the Panache entity class, or the repository parameterized type), or on one of its super classes.
(link https://quarkus.io/guides/hibernate-orm-panache#named-queries)
However it fails with :
io.quarkus.panache.common.exception.PanacheQueryException: The named query 'Test.update' must be defined on your JPA entity or one of its super classes
Expected behavior
@NamedQuery
on top of repositories works in same way as at EntitiesActual behavior
@NamedQuery
on top of repositories fails witho.quarkus.panache.common.exception.PanacheQueryException: The named query 'Test.update' must be defined on your JPA entity or one of its super classes
How to Reproduce?
Define
@Entity
, define its repository which implementsPanacheRepositoryBase<_Entity_, UUID>
, define@NamedQuery
on top of repository.Output of
uname -a
orver
No response
Output of
java -version
openjdk version "21.0.2" 2024-01-16 LTS
Quarkus version or git rev
3.11.0
Build tool (ie. output of
mvnw --version
orgradlew --version
)Gradle 8.8
Additional information
No response
The text was updated successfully, but these errors were encountered: