--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
- And probably the worst: Query.getSQL() would now render less bind values than reported by Query.getParams() and Query.getBindValues(). jOOQ could no longer interoperate with other APIs, e.g. Spring's JdbcTemplate.
Null handling is indeed not trivial, but I think this is more relevant for eq/ne than for gt/in - gt(null) should throw an NPE in my opinion,
and in(null) should probably translate to IN () ).
<in predicate> ::= <row value constructor> [ NOT ] IN <in predicate value> <in predicate value> ::= <table subquery> | <left paren> <in value list> <right paren> <in value list> ::= <value expression> { <comma> <value expression> }...
Leaving it up to the user is a reasonable decision.
In my case the column is nullable and I ended up creating a wrapper eqOrIsNull and neOrNotNull to get the behavior I was expecting.
I think it's the only reasonable decision, given that even if translating eq(null) / ne(null) seems to be a low-hanging fruit at first, it is completely unexpected and inconsistent with pretty much all of the other API.In my case the column is nullable and I ended up creating a wrapper eqOrIsNull and neOrNotNull to get the behavior I was expecting.Hmm, yes, that could be useful. Essentially, you're generating A = x OR x IS NULL for A.eq(x)?
public static <T> Condition eqOrIsNull(Field<T> fld, T val) {
return val==null ? fld.isNull() : fld.eq(val);
}
Thanks