Ranga
Ranga

Reputation: 1401

Jooq combine a list of OR conditions to a condition with AND

I have a list of conditions which should be combined with OR

List<Condition> conditions; //conditionA, conditionB, ... other conditions

I have another condition

Condition dateCondition;

Now I want to combine as below

dateCondition AND (conditionA OR conditionB ...)

What would be a good way to do this.

Is there a Jooq function to do this.

Upvotes: 1

Views: 1630

Answers (1)

Lukas Eder
Lukas Eder

Reputation: 221350

Write

dateCondition.and(DSL.or(conditions))

The method you're looking for is DSL.or(Collection<? extends Condition>)

Upvotes: 4

Related Questions