Simple Question about Records

13 views
Skip to first unread message

Robert DiFalco

unread,
Jul 2, 2015, 3:36:17 PM7/2/15
to jooq...@googlegroups.com
For some reason I can't find the straight ahead way to do this:

List<MyRecord> records = 
      dslContext
         .select()
         .from(MYRECORD)
         .join(MYRECORD_DETAIL).on(MYRECORD.ID.eq(MYRECORD_DETAIL.MYRECORD_ID))
         .where(MYRECORD_DETAIL.DATA.in("foo", "bar"))
         .fetch();

I can use selectFrom() but then I can't fluently do the join to the 1:N detail table. I can do a regular "select" with a "join" as above but then I can't figure out the correct fetch method to use to return a list of MyRecord types. In this case MyRecord is simply the updatable record class generated by JOOQ for MYRECORD.

TIA

Alok Menghrajani

unread,
Jul 2, 2015, 4:54:56 PM7/2/15
to jooq...@googlegroups.com
Look at into() and fetchInto().

I posted a similar question a couple months ago:
https://groups.google.com/d/msg/jooq-user/dq9r1bZ10vA/-QcKX6EyiucJ

Alok
> --
> 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 jooq-user+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Robert DiFalco

unread,
Jul 2, 2015, 5:01:55 PM7/2/15
to jooq...@googlegroups.com
Thanks! Do you happen to know if "into" reduces the scope of the SELECT statements or do I have to add TABLE.fields() as well to ensure I am not marshaling more data than I need. 

You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/eYzJVGYxlxM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jooq-user+...@googlegroups.com.

Alok Menghrajani

unread,
Jul 2, 2015, 5:05:06 PM7/2/15
to jooq...@googlegroups.com
You need to reduce the scope of the SELECT statement. See my last
message in that older thread.

Alok
Reply all
Reply to author
Forward
0 new messages