Query dsl with multiple in clause question

1,565 views
Skip to first unread message

Swati Malla

unread,
Jul 18, 2013, 8:09:49 PM7/18/13
to quer...@googlegroups.com
Hello All,
I have a question on query dsl ..
Is the query dsl supports multiple in queries with multiple columns .
Lets say i have a table called Employee.I want to fetch a bulk employees based on firstname.So in sql i use in query
SELECT *
FROM Tabl tabb
WHERE tabb.col IN (abc,bbc,wee,wee)
we can convert the above query to query dsl by using in operation

If i want to select a bulk records based on firstname and last name then i would write some thing like the following
SELECT * FROM Tabl tabb WHERE (tabb.col1, tabb.col2) IN ( (1,2), (3,4))

How do we convert the above query in query dsl..?

Is this is supported in query dsl..?


Thanks,
Swati


Timo Westkämper

unread,
Jul 19, 2013, 5:43:23 AM7/19/13
to Querydsl on behalf of Swati Malla
Hi.


This form is not directly supported in Querydsl.

Instead you can use a BooleanBuilder to construct the top level or-expression

BooleanBuilder builder = new BooleanBuilder();
for (...) {
    builder.or(col1.eq(a).and(col2.eq(b));
}
query.where(builder);

Is this is supported in query dsl..?


Thanks,
Swati


--
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/groups/opt_out.
 
 



--
Timo Westkämper
Mysema Oy
+358 (0)40 591 2172
www.mysema.com


Reply all
Reply to author
Forward
0 new messages