Hi Lukas,
I'm looking for a terse way to create a map grouping from a result set.
Here's my example:
ctx.select(GROUP_MEMBERS.GROUP_ID, GROUPS.NAME, GROUP_MEMBERS.USER_ID).
from(GROUP_MEMBERS).
join(GROUPS).on(GROUP_MEMBERS.GROUP_ID.eq(GROUPS.ID)).
where(GROUP_MEMBERS.REGISTRANT.eq(organization)).
fetchGroups(GROUP_MEMBERS.GROUP_ID, GROUP_MEMBERS.USER_ID);
The _ID fields are BIGINT and the NAME is a VARCHAR.
This produces
Map<Long,List<Long>>
which is half the rent. In addition, I'd like it to automagically produce a
Map<Record2<Long,String>, List<Long>>
whereby
GROUP_MEMBERS.GROUP_ID, GROUPS.NAME
are keys in the map, and
GROUP_MEMBERS.USER_ID
are elements of a List<Long> value in the map. This would avoid having
to iterate through the result (set) twice to group members.
Is there a (hidden) trick to doing this in the JOOQ API alone, or
would I need to find something in the stream API?
Cheers,
Ben
--
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.