Available in versions: Dev (3.20)
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 synonyms
Applies to ❌ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
jOOQ's code generator recognises synonyms that are declared and reported as such by the database. But some databases don't report all synonyms. In those cases, a synthetic synonym can be declared for a table:
<configuration> <generator> <database> <syntheticObjects> <synonyms> <synonym> <!-- Optional catalog of the synonym (if omitted, this is the same as the table's). --> <catalog>CATALOG</catalog> <!-- Optional schema of the synonym (if omitted, this is the same as the table's). --> <schema>SCHEMA</schema> <!-- Mandatory name of the synonym. --> <name>SYNONYM</name> <!-- Mandatory regular expression matching a tables that have this synonym. --> <table>SCHEMA\.TABLE</table> </synonym> </synonyms> </syntheticObjects> </database> </generator> </configuration>
See the configuration XSD, standalone code generation, and maven code generation for more details.
new org.jooq.meta.jaxb.Configuration() .withGenerator(new Generator() .withDatabase(new Database() .withSyntheticObjects(new SyntheticObjectsType() .withSynonyms( new SyntheticSynonymType() // Optional catalog of the synonym (if omitted, this is the same as the table's). .withCatalog("CATALOG") // Optional schema of the synonym (if omitted, this is the same as the table's). .withSchema("SCHEMA") // Mandatory name of the synonym. .withName("SYNONYM") // Mandatory regular expression matching a tables that have this synonym. .withTable("SCHEMA\\.TABLE") ) ) ) )
See the configuration XSD and programmatic code generation for more details.
import org.jooq.meta.jaxb.* configuration { generator { database { syntheticObjects { synonyms { synonym { // Optional catalog of the synonym (if omitted, this is the same as the table's). catalog = "CATALOG" // Optional schema of the synonym (if omitted, this is the same as the table's). schema = "SCHEMA" // Mandatory name of the synonym. name = "SYNONYM" // Mandatory regular expression matching a tables that have this synonym. table = "SCHEMA\\.TABLE" } } } } } }
See the configuration XSD and gradle code generation for more details.
configuration { generator { database { syntheticObjects { synonyms { synonym { // Optional catalog of the synonym (if omitted, this is the same as the table's). catalog = "CATALOG" // Optional schema of the synonym (if omitted, this is the same as the table's). schema = "SCHEMA" // Mandatory name of the synonym. name = "SYNONYM" // Mandatory regular expression matching a tables that have this synonym. table = "SCHEMA\\.TABLE" } } } } } }
See the configuration XSD and gradle code generation for more details.
generationTool { generator { database { syntheticObjects { synonyms { synonym { // Optional catalog of the synonym (if omitted, this is the same as the table's). catalog = "CATALOG" // Optional schema of the synonym (if omitted, this is the same as the table's). schema = "SCHEMA" // Mandatory name of the synonym. name = "SYNONYM" // Mandatory regular expression matching a tables that have this synonym. table = "SCHEMA\\.TABLE" } } } } } }
See the configuration XSD and gradle code generation for more details.
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!