-
Notifications
You must be signed in to change notification settings - Fork 59
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
Add support to retrieve JPQL query from Query object #25
Comments
@glassfishrobot Commented |
@glassfishrobot Commented
|
@glassfishrobot Commented |
@glassfishrobot Commented In the 3 years since this issue has been created the lack of this feature impedes my work on almost a daily basis. In particular it makes paging/sorting from services quite difficult and obscure. |
@glassfishrobot Commented String getNativeQuery(); which then aligns with how "SQL" is accessible in the query API. |
@glassfishrobot Commented Ideally something like would be standardized. Note that just String getNativeQuery() is not really enough. Some info about the translated query parameters is also needed. |
@glassfishrobot Commented |
|
FWIW, returning the JPQL/HQL string could be easily implemented in Hibernate 6.0 as the AST model provides the option to render to an HQL string. If anyone is willing to work on this, Hibernate can serve as a compatible implementation. |
Currently the interfaces javax.persistence.criteria.AbstractQuery and javax.persistence.Query have no support for retrieving the underlying JPQL Query for additional transformation which would be, especially for named queries, very useful! Just think of the fact, that you currently have to copy and paste a named query if you like to have exactly the same query with an additional predicate in the where clause. The predicate in the where clause is just an example, there are probably tons of use cases where this feature would be helpful and minimize redundant code!
I would suggest to add the following methods:
The text was updated successfully, but these errors were encountered: