The jOOQ User Manual : Code generation : Advanced generator configuration : Database : Synthetic objects : Synthetic readonly columns | previous : next |
This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.
Synthetic readonly columns
Applies to ❌ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
jOOQ's code generator recognises readonly columns if it is configured to do so. Some databases do not support "real" readonly columns, but allow for emulating them, e.g. through triggers. If a column is a known "readonly column" without formally being one, users can specify regular expressions that match all tables and columns, which will be treated as if they were formal readonly columns. For example:
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.16.5.xsd"> <generator> <database> <syntheticObjects> <readonlyColumns> <readonlyColumn> <!-- Optional regular expression matching all tables that have this identity. --> <tables>SCHEMA\.TABLE</tables> <!-- List all columns that are readonly --> <fields>ID</fields> </readonlyColumn> </readonlyColumns> </syntheticObjects> </database> </generator> </configuration>
new org.jooq.meta.jaxb.Configuration() .withGenerator(new Generator() .withDatabase(new Database() .withSyntheticObjects(new SyntheticObjectsType() .withReadonlyColumns( new SyntheticReadonlyColumnType() // Optional regular expression matching all tables that have this identity. .withTables("SCHEMA\\.TABLE") // List all columns that are readonly .withFields("ID") ) ) ) )
myConfigurationName(sourceSets.main) { generator { database { syntheticObjects { readonlyColumns { readonlyColumn { // Optional regular expression matching all tables that have this identity. tables = 'SCHEMA\\.TABLE' // List all columns that are readonly fields = 'ID' } } } } } }
As always, when regular expressions are used, they are regular expressions with default flags.
Feedback
Do you have any feedback about this page? We'd love to hear it!