How to query that a collection does NOT contain something?

1,039 views
Skip to first unread message

WT

unread,
May 8, 2015, 3:23:49 AM5/8/15
to quer...@googlegroups.com
I have a persisted class "O" that holds a Collection of Strings.  How do I query for all object of class "O" that do NOT have a specific String in their collection?

I searched for 1 hr and could not find the answer.

fasfsfgs

unread,
May 8, 2015, 8:44:19 AM5/8/15
to Querydsl on behalf of WT
How would you do in native SQL?

On Fri, May 8, 2015 at 2:55 AM, WT via Querydsl <querydsl+APn2wQcMN2N--y_j91BLyJ7...@googlegroups.com> wrote:
I have a persisted class "O" that holds a Collection of Strings.  How do I query for all object of class "O" that do NOT have a specific String in their collection?

I searched for 1 hr and could not find the answer.

--
You received this message because you are subscribed to the Google Groups "Querydsl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to querydsl+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Tontchev

unread,
May 8, 2015, 2:22:47 PM5/8/15
to quer...@googlegroups.com
Have you tried
query.from(O).where(O.tragetCollection.contains("String I want").not());
Reply all
Reply to author
Forward
0 new messages