Skip to content
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

make identification variables (and the SELECT) clause optional in JPQL #588

Merged
merged 3 commits into from
Mar 15, 2024

Conversation

gavinking
Copy link
Contributor

This is a minimal change to support the subset in Jakarta Data i.e. it is only allowed when there is just one thing in the FROM clause.

see #452

this is a minimal change to support the subset in Jakarta Data
i.e. it is only allowed when there is just one thing in the
FROM clause

see jakartaee#452
@gavinking gavinking linked an issue Mar 11, 2024 that may be closed by this pull request
@gavinking
Copy link
Contributor Author

Interesting. I came up with an alternative approach that in certain ways is even more "minimal".

We could say that whenever the identification variable is missing (in a range declaration, or in a path expression) then it is implicitly assigned the variable this.

So you could write:

select this from Entity where name like :name

And that would be equivalent to:

select this from Entity this where this.name like :name

I actually like this quite a lot. WDYT @lukasj?

@gavinking
Copy link
Contributor Author

We could say that whenever the identification variable is missing (in a range declaration, or in a path expression) then it is implicitly assigned the variable this.

I pushed a second commit which shows what that would look like.

@lukasj
Copy link
Contributor

lukasj commented Mar 15, 2024

it looks better with this, thanks!

@lukasj lukasj merged commit 006cdd7 into jakartaee:master Mar 15, 2024
2 checks passed
@gavinking
Copy link
Contributor Author

Awesome! 🎉🎉🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JPQL optional identification variable
2 participants