user4597030
user4597030

Reputation:

jOOQ - dao - primary key of inserted object

I am using the DAO's as generated by jOOQ:

<generate>
    <relations>true</relations>
    <records>true</records>
    <pojos>true</pojos>
    <daos>true</daos>
    <interfaces>true</interfaces>
    <globalObjectReferences>true</globalObjectReferences>
    <jpaAnnotations>true</jpaAnnotations>
    <validationAnnotations>true</validationAnnotations>
    <fluentSetters>true</fluentSetters>
</generate>

After inserting a POJO to the database, how do I get the created identifier/primary key? The insertion succeeds, but calling getIdentifier() on the POJO still returns null.

Upvotes: 4

Views: 1859

Answers (1)

Lukas Eder
Lukas Eder

Reputation: 221145

This is a missing feature in jOOQ 3.5 and is tracked as two independent feature requests:

Right now, you cannot fetch generated keys on insert unless you implement your own insert() method, or extend the code generator to generate that method for you.

Upvotes: 3

Related Questions