Hello Ian,

That code seems correct to me. Here are a couple of things you could check:

- Did you set <relations>true</relations> in your code-generator?
Verify that the Campaign table overrides the Identity method to
provide jOOQ with the identity column (Campaign.ID). This flag is
needed if you wish to use PK / UK / FK / ID features in jOOQ. Here is
the sample table from the integration test:
https://github.com/lukaseder/jOOQ/blob/master/jOOQ-test/src/org/jooq/test/mysql/generatedclasses/tables/TIdentityPk.java#L51

Apart from that:

- What version of MySQL are you using? jOOQ officially supports 5.1 and above
- What version of the MySQL JDBC driver are you using? I run
integration tests with mysql-connector-5.1.15

Cheers
Lukas

2012/3/24 Ian Clarke <[email protected]>:
> I'm trying to use the following code to create a row in my "campaigns"
> table: https://gist.github.com/f3f7580dcca4f9d28ae8 (using Jooq with Mysql).
>
> The campaign is created in the DB, but campaignRecord is null after this
> statement, whereas I would hope it would contain the generated value for the
> "id" field (which is set to autoincrement in my schema).
>
> What am I doing wrong here?
>
> Ian.

Reply via email to