Hi James,
Thanks for your question. jOOQ does ship with Tuple types. They're called
Record, though. Specifically, Record1<T1> through Record22<T1, T2, .., T22>:
http://www.jooq.org/doc/latest/manual/sql-execution/fetching/record-n
Just adapt your example to this, instead:
// pseudocode
final Record3<Long, UUID, Integer> record = dslContext
.select(TABLE1.FIELD1, TABLE2.FIELD2, TABLE3.FIELD3)
.from(TABLE1)
.join(TABLE2).on(...)
.join(TABLE3).on(...)
.fetchOne();
The generic <R> type that binds to Record3<Long, UUID, Integer> because of
your select() method call will be maintained until the end of the DSL
method chain, when you call one of the fetch() methods. You probably just
picked the wrong one.
Hope this helps,
Lukas
2016-04-12 21:19 GMT+02:00 <[email protected]>:
> Is it possible to fetch two or more fields from different tables into a
> Tuple like?
>
> // pseudocode
> final Tuple3<Long, UUID, Integer> record = dslContext
> .select(TABLE1.FIELD1, TABLE2.FIELD2, TABLE3.FIELD3)
> .from(TABLE1)
> .join(TABLE2).on()
> .join(TABLE3).on()
> .fetchOneInto();
>
> I'm trying to avoid having to create a small intermediate POJO. I've
> scanned the jOOQ docs and can't find an example.
> Being able to do something like this would be awesome. I'm assuming
> something like this exists; I just can't find it.
>
> Thanks again,
> James Lorenzen
>
> --
> 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/d/optout.
>
--
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/d/optout.