> Can I add query parts in any order (addFrom, addSelect, addJoin,
> AddCondition, add... )? At least following seems to work:
>
> SelectQuery query = db.select().from(AUTHOR).where(BOOK.TITLE.le("Java
> Book")).orderBy(AUTHOR.LAST_NAME,BOOK.TITLE).limit(5).getQuery();
> query.addJoin(BOOK, JoinType.LEFT_OUTER_JOIN, BOOK.AUTHOR_ID.eq(AUTHOR.ID));

Yes, this works

> i.e. query is otherwise ready but then as a last step I add the join. Is
> this coincidence or general feature of the non-DSL API?

It's a "feature". The non-DSL API evolved somewhat organically, being
a half-internal API. Expect things to be reviewed (and maybe changed)
for jOOQ 3.0 due for late 2012. In the case of addJoin(), the joined
table is joined to the last table referenced from the FROM clause. In
other words, once you've written

  select().from(A, B)

you can no longer join tables to A, only to B. If you add C using
addFrom(C), you can no longer join tables to B, only to C. In early
days of jOOQ, I thought it was a good idea to have a non-DSL API with
only "setters" and "adders", no "getters". API evolution has shown
that users will want to have full access to jOOQ's internal QueryPart
representation for many reasons, e.g. to patch SQL statements
centrally using an ExecuteListener:
http://www.jooq.org/doc/2.5/manual/sql-execution/execute-listeners/

This will all be improved in jOOQ 3.0

> My porting project is still on the way, but I have to say that jOOQ seems to
> be very promising. It is fun to work with it.

Great, good to know!

Cheers
Lukas

Reply via email to