I have refreshed my project, cleanly rebuilt it, Googled/searched StackOverflow for similar problems, read the jOOQ documentation, examined the build output for potential issues, etc.
I added a <daos>
flag to my pom.xml to generate jOOQ Database Access Objects, since the jOOQ 3.2.0 online manual says "DAO generation can be activated using the daos flag". According to the jOOQ Advanced Codegen documentation setting this flag to true generates not only DAO's, but also relations, records, and POJOs:
<generator>
...
<generate>
<daos>true</daos>
</generate>
</generator>
Prior to adding the flag to my pom, I had auto-generated records and relations but neither POJOs nor DAOs. After adding the daos
flag and rebuilding my project, I also have POJOs plus the other two but I still don't have any DAOs. The attached screenshot shows my generated classes. The classes added by the flag are in the blue box. I think there should be a package named something like "daos" with PurchaseDAO and UserDAO classes.
The jOOQ DAO documentation doesn't explain any cases where the flag is added but DAOs aren't generated. Part of the point of this project is to learn jOOQ so manually coding DAOs with jOOQ classes won't solve my problem.
EDIT: My SQLite 3.7.11 schema from the working and non-working solutions are here.
I've found in your console output that DAO is skipping,
INFO: Generating DAOs Jan 16, 2014 12:40:45 PM org.jooq.tools.JooqLogger info INFO: Skipping DAO generation : PurchaseDao.java Jan 16, 2014 12:40:45 PM org.jooq.tools.JooqLogger info INFO: Skipping DAO generation : UserDao.java Jan 16, 2014 12:40:45 PM org.jooq.tools.JooqLogger info INFO: Table DAOs generated : Total: 212.968ms, +1.759ms
After that cheked code and found next
// [#2573] Skip DAOs for tables that don't have 1-column-PKs (for now)
1287 if (keyColumn == null) {
1288 log.info("Skipping DAO generation", getStrategy().getFileName(table, Mode.DAO));
1289 return;
1290 }
I was facing the same problem today (2017).
In your configuration file, the same used on line command, e.g:
java -classpath jooq-3.10.2.jar:jooq-meta-3.10.2.jar:jooq-codegen-3.10.2.jar:mysql-connector-java-5.1.45-bin.jar:. org.jooq.util.GenerationTool
In configuration.xml, put between the tags "generator" the tag "generate" with parameters respectively.
E.g:
<generator>
...
<generate>
<pojos>false</pojos>
<daos>true</daos>
...
</generate>
</generator>
See more about these the parameters here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With