While jOOQ can be an alternative to Hibernate, it doesn’t have to entirely replace Hibernate. Many users have reported positive experiences when combining jOOQ with Hibernate, letting Hibernate do the tedious CRUD work, and jOOQ the complex querying and reporting through its sophisticated, yet intuitive query DSL.
Vlad Mihalcea who has been blogging interesting stuff about SQL and transaction models recently has now published a very nice tutorial on how to use JPA-annotated entities as a grounds for source code generation in jOOQ, through the following steps:
- Write the annotated entities
- Generate HSQLDB DDL from those entities
- Execute the DDL in an HSQLDB instance
- Run the jOOQ code generator to reverse-engineer the schema
With the above, he’s ready to query entities through JPA/Hibernate or jOOQ in no time.
Read the full blog post here: