Jooq aggregate functions

I'm trying to use an aggregate function like max, min in jOOQ, and referring to them. In jOOQ mannual, an example for the aggregate function max looks like this

create.select(max(ID).add(1).as("next_id")).from(T_AUTHOR);

but when I used max in my request, I get the function max undefined.

+5
source share
1 answer

Using static imports is documented in various places in the jOOQ tutorial and manual. Whenever you see a "stand-alone function" in the manual, you can safely assume that it was static, imported from org.jooq.impl.DSL.

See an example taken from a tutorial:

// For convenience, always static import your generated tables and
// jOOQ functions to decrease verbosity:
import static test.generated.Tables.*;
import static org.jooq.impl.DSL.*;

, , , ,

  • org.jooq.impl.DSL.max
  • DSL.max
+7

All Articles