Thanks, for the detailed & quick response
Guess the reason for using both is mostly that I didn't know i was :)
For example you start off with something like
ctx.select(*)
.from(Tables.FOO)
.leftOuterJoin(Tables.BAR).onKey(Tables.FOO.bar_id.eq(
Tables.BAR.id)
Then you learn the code generation knows about your foreign keys
ctx.select(*)
.from(Tables.FOO)
.leftOuterJoin(Tables.BAR).onKey()
Then as queries get more complex, you start having trouble with how
are all the tables with absolute references are connected/related to
each other and if the query is correct or not,
and you notice the Foo.bar() methods
ctx.select(*)
.from(Tables.FOO)
.leftOuterJoin(Tables.FOO.bar()).onKey()
has to be correct compiler verified!
Then you look at some sql logging from the database and can't read
anything, so you include some .as() aliases and everything is pretty
(both generated sql and explicit in code what it does)
Foo foo =
Tables.FOO.as("foo");
Foo bar = foo.bar().as("bar");
ctx.select(*)
.from(foo)
.leftOuterJoin(bar).onKey()
(And As i understand now possibly completely wrong usage of jooq?)
(You need the onKey for things to compile)
So more correct usage would be like
Foo foo =
Tables.FOO.as("foo");
Foo bar = foo.bar().as("bar");
ctx.select(*)
.from(foo, bar)
.helloworld()
or just not reference any joins and let jooq figure it out? I'll have
to do some more playing around and reread some documentation
Can't do for example rightJoins then ?
Regards
> To view this discussion on the web visit
https://groups.google.com/d/msgid/jooq-user/CAB4ELO4HhFBfg_%3DU4ySdZ8k3FYPLzZmSqfP8Ktzq6XX2gwm8cA%40mail.gmail.com.