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

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

Comments

Projects
None yet
2 participants
@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

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Aug 20, 2012

Member

Thanks for bug report, Luis.

Fixed this according your suggestion.

Member

timowest commented Aug 20, 2012

Thanks for bug report, Luis.

Fixed this according your suggestion.

@luisfpg

This comment has been minimized.

Show comment
Hide comment
@luisfpg

luisfpg Aug 21, 2012

Lightning fast as always!
Thanks, Timo.

luisfpg commented Aug 21, 2012

Lightning fast as always!
Thanks, Timo.

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Sep 10, 2012

Member

Released in 2.7.3

Member

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