Casting, coercing, and collating
jOOQ was designed to handle most of the casting issues under the hood, including for ultra-strong-typed databases such as DB2. Nevertheless, explicit casting and/or coercing still serve some isolated cases. Most probably, we'll need them when we are not satisfied with the jOOQ automatic mapping (for instance, we consider that jOOQ didn't find the most accurate mapping), or we just need a certain type to respond to a special case. Even if they add a little bit of verbosity, casting and coercing can be used fluently; therefore, the DSL expressions are not disrupted.
Casting
Most of the time, jOOQ finds the most accurate data type mapping between the database and Java. If we look into a jOOQ generated class that mirrors a database table, then we see that, for each column that has a database-specific type (for example, VARCHAR
), jOOQ has found a Java type correspondent (for example, String
). If we compare the schema of the PAYMENT
table...