Hello,

Actually, the question was: why can't I use joins when using selectFrom 
statement?

At first, I thought that "selectFrom(SOURCE).fetchInto(TARGET)" meant 
"insert into TARGET (...) select .. from SOURCE".

Thanks for your help.
Gérald

Le lundi 11 novembre 2013 10:13:43 UTC+1, Lukas Eder a écrit :
>
> Hello,
>
> 2013/11/10 <[email protected] <javascript:>>
>
>> Hi,
>>
>> I can write
>> Result<BookRecord> bookRecords=jooq.selectFrom(BOOK)
>>    .where(BOOK.TITLE.eq("Les Misérables"))
>>    .fetch();
>>
>> But I can't add a join, I can't write:
>> Result<BookRecord> bookRecords=jooq.selectFrom(BOOK)
>>     .join(AUTHOR).on(BOOK.AUTHOR_ID.eq(AUTHOR.ID))
>>     .where(AUTHOR.NAME.eq("Victor Hugo"))
>>     .fetch();
>>
>> I had to write:
>> List<BookRecord> bookRecords=jooq.select(BOOK.fields()).from(BOOK)
>>     .join(AUTHOR).on(BOOK.AUTHOR_ID.eq(AUTHOR.ID))
>>     .where(AUTHOR.NAME.eq("Victor Hugo"))
>>     .fetchInto(BookRecord.class);
>>
>> Is there an easier way to do the same? How can I tell JOOQ to return 
>> Result<BookRecord> instead of Result<Record>/List<BookRecord>?
>>
>
> Instead of 
>
>     .fetchInto(BookRecord.class);
>
> You could write
>
>     .fetchInto(BOOK);
>
> See: 
> http://www.jooq.org/javadoc/latest/org/jooq/ResultQuery.html#fetchInto(org.jooq.Table)
>
> You could also write a semi-join using an IN or EXISTS predicate, instead 
> of joining.
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to