-
Notifications
You must be signed in to change notification settings - Fork 30
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
Update the Javadoc of @Query after merge of JDQL #551
Conversation
@njr-11 These restrictions you're worried about made perfect sense when But now the language is JDQL, which is syntactically trivial. Those restrictions no longer make any sense. |
306f6ab
to
0c81a33
Compare
What we have written is that the language can be JDQL or JPQL. If a Jakarta Persistence-backed Jakarta Data provider is going to handle both, then the additional restrictions do matter. |
Sure, but I really don't think it's placing an undue burden on a Jakarta Data provider which is backed by Jakarta Persistence to be able to understand JPQL if and only if that Jakarta Data provider voluntarily decides to also support arbitrary JPQL and pagination. The spec does not place any requirement on such a provider to be able to support pagination with arbitrary JPQL, so if the provider disagrees with me, and thinks that being able to parse JPQL is a burden, then it is between the provider and the user to define how such extensions work. All the spec requires is that the provider be able to handle JDQL. |
To be clear, what we say about this is:
and in the spec:
So we do not need to explicitly place limitations on JPQL support. |
Force pushed to clean up commit history. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, the separate
count()
query is just no longer needed. That's one advantage of having our own query language!
I can certainly see the appeal of being able to get rid of the count
query now that one can be assembled by replacing the SELECT
clause and removing the ORDER BY
clause from the primary query if using JDQL. I need to give this some more thought about where we end up with JPQL. It is certain that many users will opt for JPQL given that they are able to accomplish more with it, and we will want to be sure they aren't broken or consider themselves broken because there is no standard assuring them that pagination will still work.
FTR, the thing you would need to do with JPQL is replace everything between Now, on the other hand, some providers, [i.e. Hibernate, but not, I believe, EclipseLink], do allow subqueries in |
Note also, that Hibernate has a method that does this for you: EclipseLink might also have something like that. |
Oh yes, and remove |
Also caught some more instances of 'run time' -> 'runtime', 'life cycle' -> 'lifecycle'
Co-authored-by: Nathan Rauh <[email protected]>
since the provider can just replace everything between "select" and "from" with "count(this)"
* | ||
* <p><b>Positional parameters</b> are referred to by a number that corresponds to the | ||
* numerical position, starting with 1, of the repository method parameters.</p> | ||
* <p>Annotates a repository method as a query method, specifying a query written in Jakarta Data Query Language (JDQL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That might lead to a complex discussion, but using the self-continued principle and using JPQL as a sample, we are once again able to cross-database specification.
/**
* <p>Annotates a repository method as a query method, specifying a query written in Jakarta Data Query Language (JDQL)
* as the minimum requirement. This encourages the use of JDQL for cross-database compatibility. Additionally, a Jakarta Data
* provider has the freedom to support extensions to the language, including features from the Jakarta Persistence Query Language (JPQL).
* While providers are not required to support the complete JPQL language, which primarily targets relational data stores, they are
* encouraged to provide as broad a support as possible to enhance the flexibility and power of data access queries.</p>
*/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's nothing wrong with what you just wrote, just not sure it's quite the right place to be saying things like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put it here as a sample because it was the first paragraph. The point here is that the documentation leads to JDQL or JPQL.
However, it would be great to allow NoSQL to take advantage of this advantage.
For example:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I think I understand what you're looking for. Just not quite sure how to say it in a way which isn't out of place in the doc for that annotation. (It's the kind of thing that fits more comfortably in the spec or in module-info
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@otaviojava please see 628abf4. Is that sorta approximately like what you would like to see?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be acceptable to remove the counting query and have it be generated from the primary query and also to lift the restriction to have parenthesis around WHERE. The other restriction should not be removed.
Co-authored-by: Nathan Rauh <[email protected]>
This reverts commit 1bde0e7.
@njr-11 @otaviojava are there any remaining problems with this or is it OK to merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@njr-11 @otaviojava are there any remaining problems with this or is it OK to merge?
I was only waiting to review the outcome of the conversation between you and Otavio, but the pull looks find as is so I can approve it. If more commits do get added, I'll try to remember to watch out for that and review them.
Awesome!! So according to me, JDQL is done and |
This was now very out of date, and I forgot about it in #520.
Also caught some more instances of 'run time' -> 'runtime', 'life cycle' -> 'lifecycle'.