Hello,

> 1. Add various WHERE conditions

You have several options. The simplest one is to provide jOOQ with an
array or a Collection of Conditions:

List<Condition> conditions = new ArrayList<Condition>();
conditions.add(FIELD1.equal(123));
conditions.add(FIELD2.equal("abc"));
create.select().from(...).where(conditions);

See the Javadoc for more details:
http://jooq.sourceforge.net/javadoc/latest/org/jooq/SelectWhereStep.html#where%28org.jooq.Condition...%29

If I know more about your use-case, then I can provide you with more details.

> 2. Build DSL query from parts (from, where, group, by etc)

What do you mean by this? Maybe you shouldn't use the fluent API
(DSL), but use the object-oriented API (default) instead?

Documented here:
https://sourceforge.net/apps/trac/jooq/wiki/Manual/JOOQ/Query

An extract:
// Re-use the factory to create a SelectQuery.
// This example will not make use of static imports...
SelectQuery q = create.selectQuery();
q.addFrom(TAuthor.T_AUTHOR);

// This example shows some "mixed" API usage, where the JOIN
// is added with the standard API, and the Condition is created
// using the DSL API
q.addJoin(TBook.T_BOOK, TAuthor.ID.equal(TBook.AUTHOR_ID));

// The AND operator between Conditions is implicit here
q.addConditions(TAuthor.YEAR_OF_BIRTH.greaterThan(1920));
q.addConditions(TAuthor.FIRST_NAME.equal("Paulo"));
q.addOrderBy(TBook.TITLE);

Reply via email to