I would like to create sql expression in JOOQ:
a OR b AND c
But I cannot find a way to do that, when combining conditions in JOOQ:
a.or(b).and(c)
It always be (a OR b) and C. I know why, but how can I achieve to not do this?
I wouldnt like to concat it in String. (thats the only solution what I have found so far.)
When you write:
a.or(b).and(c);
Then you're really writing:
var c1 = a.or(b);
var c2 = c1.and(c);
This is just Java, it doesn't have anything to do with jOOQ, strictly speaking. So, if you want to give higher precedence to the right operand of your OR
predicate, write
a.or(b.and(c));
Think about it again this way:
var c1 = b.and(c);
var c2 = a.or(c1);
Again, this isn't related to jOOQ, it's just Java code. And as you can see, jOOQ queries are always dynamic, irrespective of whether you make them look like ordinary SQL (by writing them using the fluent API), or whether you assign parts of your query to local variables, or return them from functions. It's all the same to jOOQ.