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 <ian.c...@gmail.com>:
- 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).
@Override
public org.jooq.UniqueKey<amplify.jooq.tables.records.CampaignsRecord> getMainKey() {
return amplify.jooq.Keys.KEY_CAMPAIGNS_PRIMARY;
}
- 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
> In case it's useful, here is the mysql dump of the campaigns table:
>
> https://gist.github.com/46e5fa5f5a768725eb7c
I tried running the code generator on your table with my setup and it
correctly generated an identity for campaigns.id. So the problem is
not related to your JDBC driver. There's probably a bug in
jooq-codegen's MySQL integration.
>> - What version of MySQL are you using? jOOQ officially supports 5.1 and
>> above
>
> I'm using 5.5.20
Maybe there is some feature in the MySQL dictionary views, that I am
not aware of. What does the following query return on your system?
SELECT extra FROM information_schema.columns
WHERE lower(table_name) = 'campaigns'
AND lower(column_name) = 'id'
Cheers
Lukas
That is precisely what jooq-meta expects: "auto_increment". I'm afraid
that everything looks ok to me. To further analyse this, you could try
these two things:
- Debug jooq-meta and set a breakpoint around here to see what's happening:
https://github.com/lukaseder/jOOQ/blob/master/jOOQ-meta/src/main/java/org/jooq/util/mysql/MySQLTableDefinition.java#L114
- Run jooq-codegen with log4j and log-level trace. You could post that
log output somewhere, I could have a look. Here's a sample log4j
configuration (change "debug" to "trace"):
https://github.com/lukaseder/jOOQ/blob/master/jOOQ-test/src/log4j.xml
Cheers
Lukas
2012/3/25 Ian Clarke <ian.c...@gmail.com>:
Hello Ian,
That is precisely what jooq-meta expects: "auto_increment". I'm afraid
that everything looks ok to me. To further analyse this, you could try
these two things:
- Debug jooq-meta and set a breakpoint around here to see what's happening:
https://github.com/lukaseder/jOOQ/blob/master/jOOQ-meta/src/main/java/org/jooq/util/mysql/MySQLTableDefinition.java#L114
Line numbers may have shifted. From your code snippets, I guess you're
using jOOQ 2.0.5. The link I posted is from 2.2.0-SNAPSHOT.
> I'll try trace debugging, not that familiar with log4j but I'll figure it
> out.
It will be sufficient to put log4j.jar and the log4j.xml file on the
classpath. jOOQ will discover it automatically, then.
Cheers
Lukas
>> https://github.com/lukaseder/jOOQ/blob/master/jOOQ-meta/src/main/java/org/jooq/util/mysql/MySQLTableDefinition.java#L114Line numbers may have shifted. From your code snippets, I guess you're
>
> I tried that, and it's possible I was using Eclipse's debugger incorrectly,
> but it apparently didn't hit that breakpoint :-/ Is that possible?
using jOOQ 2.0.5. The link I posted is from 2.2.0-SNAPSHOT.
> I'll try trace debugging, not that familiar with log4j but I'll figure itIt will be sufficient to put log4j.jar and the log4j.xml file on the
> out.
classpath. jOOQ will discover it automatically, then.
Did you have any luck further investigating this issue where
identities weren't generated by jooq-codegen?
Cheers
Lukas
2012/3/26 Ian Clarke <ian.c...@gmail.com>:
Cheers
Lukas
2012/4/11 Ian Clarke <ian.c...@gmail.com>:
Thanks for your feedback. I've been made aware of this about a month
ago. Unfortunately, I couldn't reproduce it so far, using Ian's DDL.
Can you help me reproduce this? What setup is required for a MySQL
AUTO_INCREMENT column not to generate an IDENTITY in jOOQ-generated
artefacts?
Cheers
Lukas
2012/4/20 Christopher Riley <rigu...@gmail.com>:
--
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/d/optout.