2016-06-21 16:02 GMT+01:00 Christian Meyer <[email protected]>:

> Hi Lukas,
>
> thanks for your patience...
>

No worries :)


> I'm not sure how you intend to model composite primary keys. It could be
>> done e.g. with a jOOλ Tuple[N] type (see https://github.com/jOOQ/jOOL)
>>
>
> Yep, that's the problem. First, I thought about solving it the JPA-way.
> But then again, this is not doable: Having a(n embedded) FooBarPk doesn't
> help when you want to do something like:
>
> dslContext.selectFrom(rTable).where(pkField.eq(source.primaryKey))
>
>
Aha, so you could use jOOQ's Row[N] types or Record[N] types instead!
Because with those, you can write stuff like:

dslContext.selectFrom(rTable).where(pkRow.eq(source.primaryKey))

See for instance
http://www.jooq.org/javadoc/latest/org/jooq/Row2.html#eq-org.jooq.Record2-

Actually, in DAOImpl you use getId() which is generated via your generator.
> I guess it also works for composite primary keys, right? Is it possible to
> use this implementation also to implement getPrimaryKey()?
>

Yes, indeed. I hadn't thought of that. In these cases, DAO's <T> type
(primary key type) gets bound to something like Record2<Integer, String>.
It's a bit of work, but certainly you will find good hints in the DAO
generation logic inside of JavaGenerator

Lukas

-- 
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.

Reply via email to