JOOQ - method call

I have a question about calling the count () method in the following jOOQ example:

create.select(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME, count())
      .from(AUTHOR)
      .join(BOOK).on(AUTHOR.ID.equal(BOOK.AUTHOR_ID))
      .where(BOOK.LANGUAGE.eq("DE"))
      .and(BOOK.PUBLISHED.gt(date("2008-01-01")))
      .groupBy(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME)
      .having(count().gt(5))
      .orderBy(AUTHOR.LAST_NAME.asc().nullsFirst())
      .limit(2)
      .offset(1)
      .forUpdate()
      .of(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME)

      

I tried to create a mechanism like this to call a method without object / class reference, but I gave up. Is it really possible?

Thanks for the help.

Wicia

+3


source to share


1 answer


Hang in there! :-)

You are giving the first example from the site. I suggest you check out the instructions on how to read the manual (I know it sounds like I'm RTFM you.) Sorry you will find some explanations, for example

// Whenever you see "standalone functions", assume they were static imported 
// from org.jooq.impl.DSL. "DSL" is the entry point of the static query DSL

exists(); max(); min(); val(); inline();
// correspond to DSL.exists(); DSL.max(); DSL.min(); etc...

      



The tutorial also shows how to do this, i.e. with static imports:

// 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.*;

      

Note that there is a pending feature request # 3503 to improve the manual and website with tooltips to explain these things to new users, which will quickly become common practice when you get jOOQ stuck.

+5


source







All Articles