Example jOOQ query with more than 22 columns

I am looking for examples of how I can execute a jOOQ query with more than 22 lines.

http://www.jooq.org/doc/latest/manual/sql-building/column-expressions/row-value-expressions/

tells me that this is possible, but I could not find an example.

Can someone point me in the right direction?

+4
source share
2 answers

As of jOOQ 3.7 (and there are currently no plans to change it), 22 is the maximum number of columns that can be selected in a safe way. In addition to 22, you can still execute queries, but the jOOQ API will no longer track the type of your records. For example:

// Still type safe
Result<Record22<Integer, String, ..., Integer>> result =
DSL.using(configuration)
   .select(INT_COLUMN1, STRING_COLUMN2, ..., INT_COLUMN22)
   .from(TABLE)
   .fetch();

// Add one more column, and "lose" type safety
Result<Record> result =
DSL.using(configuration)
   .select(INT_COLUMN1, STRING_COLUMN2, ..., INT_COLUMN22, STRING_COLUMN23)
   .from(TABLE)
   .fetch();

API API "" , , 22 ( ) 23 ( ).

UNION

UNION :

// Still type safe
Result<Record22<Integer, String, ..., Integer>> result =
DSL.using(configuration)
   .select(INT_COLUMN1, STRING_COLUMN2, ..., INT_COLUMN21)
   .from(TABLE)
   .union(
//  ^^^^^ compilation error here
    select(INT_COLUMN1, STRING_COLUMN2, ..., INT_COLUMN21, INT_COLUMN22)
   .from(TABLE))
   .fetch();

// Add one more column, and "lose" type safety
Result<Record> result =
DSL.using(configuration)
   .select(INT_COLUMN1, STRING_COLUMN2, ..., STRING_COLUMN23)
   .from(TABLE)
   .union(
//  ^^^^^ This compiles, even if it wrong
    select(INT_COLUMN1, STRING_COLUMN2, ..., STRING_COLUMN23, STRING_COLUMN24)
   .from(TABLE))
   .fetch();
+3

, : jOOQ - UPDATE... SET...

jooq, google.

0

Source: https://habr.com/ru/post/1618499/


All Articles