Re: I can't seem to find any example of how to use Existing pojos.....

2017-04-02 Thread Rob Sargent
You would be hard pressed to name a language for which it doesn’t exist. > On Apr 2, 2017, at 8:21 AM, Lukas Eder wrote: > > I see, I wonder if that exists for Java / jOOQ code :) > > 2017-03-30 23:35 GMT+02:00 Rob Sargent : > LOL. It's just "some nice feature" which has done sensible indentat

Re: I can't seem to find any example of how to use Existing pojos.....

2017-04-02 Thread Lukas Eder
I see, I wonder if that exists for Java / jOOQ code :) 2017-03-30 23:35 GMT+02:00 Rob Sargent : > LOL. It's just "some nice feature" which has done sensible indentation in > code for more years than I care to remember. > > On 03/30/2017 03:24 PM, Lukas Eder wrote: > > > > 2017-03-30 19:48 GMT+02

Re: I can't seem to find any example of how to use Existing pojos.....

2017-03-30 Thread Rob Sargent
LOL. It's just "some nice feature" which has done sensible indentation in code for more years than I care to remember. On 03/30/2017 03:24 PM, Lukas Eder wrote: 2017-03-30 19:48 GMT+02:00 Rob Sargent >: Thank you for the guidance and confirmation. The fi

Re: I can't seem to find any example of how to use Existing pojos.....

2017-03-30 Thread Lukas Eder
2017-03-30 19:48 GMT+02:00 Rob Sargent : > 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. > jOOQ takes you where ever you want to go. Also, jOOQ won't judge you if where you want to go is not a good idea to

Re: I can't seem to find any example of how to use Existing pojos.....

2017-03-30 Thread Rob Sargent
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 :) ) On 03/29/2017 03:30 AM, Lukas Eder wrote: Comment inline... 2017-03-28 20:36 GMT+02:00 Rob Sarge

Re: I can't seem to find any example of how to use Existing pojos.....

2017-03-29 Thread Lukas Eder
Comment inline... 2017-03-28 20:36 GMT+02:00 Rob Sargent : > Thank you again, all of these work: > > Map fullMap = new HashMap<>(); > fullMap.putAll(ctx.select(PERSON.fields()) >.from(PERSON.join(ALIAS) > .on(PERSON.ID.equal(ALI

Re: I can't seem to find any example of how to use Existing pojos.....

2017-03-29 Thread Lukas Eder
2017-03-28 18:29 GMT+02:00 Rob Sargent : > but I was certain there was a flavour of fetchMap(String, Record) that > would do the trick. > There's one version that takes a Class as the second argument: fetchMap(String, Class), but that can lead to ambiguities if your JOIN produces duplicate column

Re: I can't seem to find any example of how to use Existing pojos.....

2017-03-28 Thread Rob Sargent
Thank you again, all of these work: Map 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)) .fetchMa

Re: I can't seem to find any example of how to use Existing pojos.....

2017-03-28 Thread Rob Sargent
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))

Re: I can't seem to find any example of how to use Existing pojos.....

2017-03-28 Thread Lukas Eder
Hmm, I thought there was a fetchMap(Field, Table) method but there isn't. In that case, you could do: DSL.using(configuration) .select(...) .from(...) .fetchMap(MY_TABLE.KEY_FIELD, r -> r.into(PERSON)); This will be using the Record.into(Table) method: https://www.jooq.org/javadoc/latest

Re: I can't seem to find any example of how to use Existing pojos.....

2017-03-28 Thread Rob Sargent
Map is a different matter I think. > On Mar 27, 2017, at 9:25 PM, Samir Faci wrote: > > fetchMap: > > Map userMapping = > complexQuery.fetchMap(schema.table.fieldname, schema.table.fieldname2); > > I've used the exact same pattern for fetchMap irrelevant of the complexity of > the SQL and

Re: I can't seem to find any example of how to use Existing pojos.....

2017-03-27 Thread Samir Faci
fetchMap: Map userMapping = complexQuery.fetchMap(schema.table.fieldname, schema.table.fieldname2); I've used the exact same pattern for fetchMap irrelevant of the complexity of the SQL and it works fine for me. I do find repeating the field names a bit repetitive but it does work. If you're o

Re: I can't seem to find any example of how to use Existing pojos.....

2017-03-27 Thread Rob Sargent
Are there any actual examples of RecordMapper working with fetchMap() on results of joins? I can map a direct select to a string (name field), but not for a join. I've wondered through the code for DefaultRecordMapper, Record and RecordType but still haven't managed to get a usable mapper the wi

Re: I can't seem to find any example of how to use Existing pojos.....

2013-07-23 Thread Lukas Eder
Hi Ryan, Unlike most JPA-based ORMs, jOOQ cleanly separates querying from mapping. There is no implicit knowledge about relations between your document and annotation tables, unless you explicitly join the two tables in your SQL statement. Once the result is fetched, you have lots of means of mapp

I can't seem to find any example of how to use Existing pojos.....

2013-07-20 Thread Ryan Cornia
I have an application with existing POJO's (and many hand coded SQL statements) I would like to try JOOQ on. I can't find any examples of how to do this? Do I need to configure JOOQ programmatically so it knows, for instance, I have a Document table and Annotation table, and how they are relat