The jOOQ User Manual : Code generation : Advanced generator configuration : Generate : Implicit JOIN paths | previous : next |
Implicit JOIN paths
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
Implicit JOINs are one of jOOQ's most powerful synthetic SQL features, which depends entirely on code generation. The code generator produces links between tables that follow "to-one" relationships (i.e. from child table to parent table). This way, it is possible to greatly simplify your queries:
// Get all books, their authors, and their respective language create.select( BOOK.author().FIRST_NAME, BOOK.author().LAST_NAME, BOOK.TITLE, BOOK.language().CD.as("language")) .from(BOOK) .fetch();
The feature has a few feature toggles in the code generator, including:
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.11.0.xsd"> <generator> <generate> <!-- Allowing to turn off the feature entirely. The default is true. --> <implicitJoinPathsToOne>true</implicitJoinPathsToOne> </generate> </generator> </configuration>
new org.jooq.meta.jaxb.Configuration() .withGenerator( new Generate() // Allowing to turn off the feature entirely. The default is true. .withImplicitJoinPathsToOne(true) )
myConfigurationName(sourceSets.main) { generator { generate { // Allowing to turn off the feature entirely. The default is true. implicitJoinPathsToOne = true } } }
Feedback
Do you have any feedback about this page? We'd love to hear it!