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

JPA: Using collection.any().in(...) in element collections #217

Closed
luisfpg opened this issue Aug 20, 2012 · 3 comments
Closed

JPA: Using collection.any().in(...) in element collections #217

luisfpg opened this issue Aug 20, 2012 · 3 comments

Comments

@luisfpg
Copy link

@luisfpg luisfpg commented Aug 20, 2012

When using collection.any().in(...) in a collection path representing a collection of elements (not persistent entities), the generated JPQL contains "from ElementClass alias ...", which is invalid.
Here is an example of a possible solution, imagining the User entity with a collection of enums Role:

QUser u = QUser.user1;
from(u).where(u.roles.any().in(Role.ADMIN, Role.MANAGER);

could generate:

select u
from User u
where exists (
    select 1
    from User u1 join u1.roles r
    where u1 = u
    and  r in :roles
)
@timowest
Copy link
Member

@timowest timowest commented Aug 20, 2012

Thanks for bug report, Luis.

Fixed this according your suggestion.

@luisfpg
Copy link
Author

@luisfpg luisfpg commented Aug 21, 2012

Lightning fast as always!
Thanks, Timo.

@timowest
Copy link
Member

@timowest timowest commented Sep 10, 2012

Released in 2.7.3

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

Successfully merging a pull request may close this issue.

None yet
2 participants