Subexpressions with spring data

42 views
Skip to first unread message

Anders Mikkelsen

unread,
May 22, 2018, 2:51:03 AM5/22/18
to Querydsl
Hey

I'm using Querydsl together with Spring data JPA. I'm having trouble figuring out how to constrain that an entity should exist in a collection.

So far I'm doing:


builder.and(exp.sub.any().user.id.eq(user.getId()).and(QSub.sub.selected.isTrue()));



However this creates a query which finds entites where any of the two conditions are fulfilled. I've found other places suggesting SubQuery, however I don't know how to actually express this.
Reply all
Reply to author
Forward
0 new messages