--
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/groups/opt_out.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
For more options, visit https://groups.google.com/d/optout.
Thank you for the suggestion, which I'll try shortly. I have had success with this
fullMap.putAll(ctx.selectFrom(PERSON)
.whereExists(ctx.selectOne()
.from(ctx.select().from(ALIAS)
.where(ALIAS.AKA.in(nameSet).and(ALIAS.PERSON_ID.equal(PERSON.ID)))))
.fetchMap(PERSON.NAME));
but I was certain there was a flavour of fetchMap(String, Record) that would do the trick.
For more options, visit https://groups.google.com/d/optout.
Thank you again, all of these work:
Map<String, PersonRecord> fullMap = new
HashMap<>();
fullMap.putAll(ctx.select(PERSON.fields())
.from(PERSON.join(ALIAS)
.on(PERSON.ID.equal(ALIAS.PERSON_ID)))
.where(ALIAS.AKA.in(nameSet))
.fetchMap(PERSON.NAME, r ->
r.into(PERSON)));
fullMap.putAll(ctx.select(PERSON.fields())
.from(PERSON.join(ALIAS)
.on(PERSON.ID.equal(ALIAS.PERSON_ID)
.and(ALIAS.AKA.in(nameSet))))
.fetchMap(PERSON.NAME, r ->
r.into(PERSON)));
fullMap.putAll(ctx.select(PERSON.fields())
.from(PERSON.join(ALIAS)
.on(PERSON.ID.equal(ALIAS.PERSON_ID))
.and(ALIAS.AKA.in(nameSet)))
.fetchMap(PERSON.NAME, r ->
r.into(PERSON)));
Is any more proper than the other?
I had gotten side tracked thinking I needed to use a
RecordMapper but could never set that up properly.
For more options, visit https://groups.google.com/d/optout.
but I was certain there was a flavour of fetchMap(String, Record) that would do the trick.
Thank you again, all of these work:
Map<String, PersonRecord> fullMap = new HashMap<>();
fullMap.putAll(ctx.select(PERSON.fields())
.from(PERSON.join(ALIAS)
.on(PERSON.ID.equal(ALIAS.PERSON_ID)))
.where(ALIAS.AKA.in(nameSet))
.fetchMap(PERSON.NAME, r -> r.into(PERSON)));
fullMap.putAll(ctx.select(PERSON.fields())
.from(PERSON.join(ALIAS)
.on(PERSON.ID.equal(ALIAS.PERSON_ID)
.and(ALIAS.AKA.in(nameSet))))
.fetchMap(PERSON.NAME, r -> r.into(PERSON)));
fullMap.putAll(ctx.select(PERSON.fields())
.from(PERSON.join(ALIAS)
.on(PERSON.ID.equal(ALIAS.PERSON_ID))
.and(ALIAS.AKA.in(nameSet)))
.fetchMap(PERSON.NAME, r -> r.into(PERSON)));
Is any more proper than the other?
I had gotten side tracked thinking I needed to use a RecordMapper but could never set that up properly.
Thank you for the guidance and confirmation. The first
option was from my sql instinct, but I wanted to see where jOOQ
might take me. (The parenthesis mess is nicely managed for me by
emacs :) )
Thank you for the guidance and confirmation. The first option was from my sql instinct, but I wanted to see where jOOQ might take me.
(The parenthesis mess is nicely managed for me by emacs :) )
LOL. It's just "some nice feature" which has done sensible
indentation in code for more years than I care to remember.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.
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 jooq-user+unsubscribe@googlegroups.com.