All versions: 3.11 | Development versions: 3.12

Many databases support "collations", which defines the sort order on character data types, such as VARCHAR.

Such databases usually allow for specifying:

  • System-wide default collations
  • Session-wide default collations
  • Per-table specific default collations
  • Per-column specific default collations
  • Per-usage specific collation

The actual implementation is vendor-specific, including the way the above defaults override each other.

To accommodate most use-cases jOOQ 3.11 introduced the org.jooq.Collation type, which can be attached to a org.jooq.DataType through DataType.collate(Collation), or to a org.jooq.Field through Field.collate(Collation), for example:

SELECT * 
FROM book 
ORDER BY title COLLATE utf8_bin
create.selectFrom(BOOK)
      .orderBy(BOOK.TITLE.collate("utf8_bin"))
      .fetch();
The jOOQ Logo