I need to use table name/column names in annotations so they must be constant (can't call TABLE1.getName()
).
Is there a way to have Jooq code generator generate these automatically in the format of public static final String TABLE1 = "table1"
and similarly for columns inside each table?
I need to use table name/column names in annotations so they must be constant (can't call TABLE1.getName()
).
Is there a way to have Jooq code generator generate these automatically in the format of public static final String TABLE1 = "table1"
and similarly for columns inside each table?
Share Improve this question edited 6 hours ago jonrsharpe 122k30 gold badges267 silver badges474 bronze badges asked 7 hours ago MahdiMahdi 2,2933 gold badges28 silver badges49 bronze badges1 Answer
Reset to default 1In jOOQ 3.19+, you can enable globalObjectNames
in the code generator:
https://www.jooq./doc/latest/manual/code-generation/codegen-advanced/codegen-config-generate/codegen-generate-global-object-names/
Here's how to configure it with Maven
<configuration>
<generator>
<generate>
<globalObjectNames>true</globalObjectNames>
</generate>
</generator>
</configuration>
Or Gradle:
configuration {
generator {
generate {
isGlobalObjectNames = true
}
}
}