Multiple condition under select in LambdaJ

853 Views Asked by At

I'm looking to select using two conditions in LambdaJ select, i've tried to use and() function but i can't figure out how to use it.the above code selects using one condition. how i could add another condition?

select(filteredPB,     having(on(Table.class).getId(), IsEqual.equalTo(key))) 
1

There are 1 best solutions below

0
El Suscriptor Justiciero On

You could use Matchers.allOf for ANDs and Matchers.anyOf for ORs. Like this:

select(filteredPB, Matchers.allOf(
    having(on(Table.class).getId(), IsEqual.equalTo(key)),
    having(on(Table.class).getValue(), IsEqual.equalTo(value))
))