New versions: Dev (3.16) | Latest (3.15) | 3.14 | 3.13 | 3.12 | 3.11 | 3.10 | 3.9

Include object types

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

Sometimes, you want to generate only tables. Or only routines. Or you want to exclude them from being generated. Whatever the use-case, there's a way to do this with the following, additional includes flags:

XML (standalone and maven)
Programmatic
Gradle
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.15.0.xsd">
  <generator>
    <database>
      <includeTables>true</includeTables>
      <includeSystemTables>false</includeSystemTables>
      <includeInvisibleColumns>true</includeInvisibleColumns>
      <includeEmbeddables>true</includeEmbeddables>
      <includeRoutines>true</includeRoutines>
      <includePackages>true</includePackages>
      <includePackageRoutines>true</includePackageRoutines>
      <includePackageUDTs>true</includePackageUDTs>
      <includePackageConstants>true</includePackageConstants>
      <includeUDTs>true</includeUDTs>
      <includeDomains>true</includeDomains>
      <includeSequences>false</includeSequences>
      <includeSystemSequences>false</includeSystemSequences>
      <includePrimaryKeys>false</includePrimaryKeys>
      <includeUniqueKeys>false</includeUniqueKeys>
      <includeForeignKeys>false</includeForeignKeys>
      <includeCheckConstraints>false</includeCheckConstraints>
      <includeSystemCheckConstraints>false</includeSystemCheckConstraints>
      <includeIndexes>false</includeIndexes>
      <includeSystemIndexes>false</includeSystemIndexes>
    </database>
  </generator>
</configuration>
new org.jooq.meta.jaxb.Configuration()
  .withGenerator(new Generator()
    .withDatabase(new Database()
      .withIncludeTables(true)
      .withIncludeSystemTables(false)
      .withIncludeInvisibleColumns(true)
      .withIncludeEmbeddables(true)
      .withIncludeRoutines(true)
      .withIncludePackages(true)
      .withIncludePackageRoutines(true)
      .withIncludePackageUDTs(true)
      .withIncludePackageConstants(true)
      .withIncludeUDTs(true)
      .withIncludeDomains(true)
      .withIncludeSequences(false)
      .withIncludeSystemSequences(false)
      .withIncludePrimaryKeys(false)
      .withIncludeUniqueKeys(false)
      .withIncludeForeignKeys(false)
      .withIncludeCheckConstraints(false)
      .withIncludeSystemCheckConstraints(false)
      .withIncludeIndexes(false)
      .withIncludeSystemIndexes(false)
    )
  )
myConfigurationName(sourceSets.main) {
  generator {
    database {
      includeTables = true
      includeSystemTables = false
      includeInvisibleColumns = true
      includeEmbeddables = true
      includeRoutines = true
      includePackages = true
      includePackageRoutines = true
      includePackageUDTs = true
      includePackageConstants = true
      includeUDTs = true
      includeDomains = true
      includeSequences = false
      includeSystemSequences = false
      includePrimaryKeys = false
      includeUniqueKeys = false
      includeForeignKeys = false
      includeCheckConstraints = false
      includeSystemCheckConstraints = false
      includeIndexes = false
      includeSystemIndexes = false
    }
  }
}

By default, most of these flags are set to true, with the exception of:

  • includeSystemCheckConstraints: Some databases produce auxiliary CHECK constraints for other constraints like NOT NULL constraints. The redundant information is usually undesirable, which is why these are turned off by default.
  • includeSystemIndexes: Some databases produce auxiliary INDEX objects for other constraints like FOREIGN KEY constraints. These indexes are not independent from the key, and the redundant information is usually undesirable, which is why these are turned off by default.
  • includeSystemSequences: Some database produce auxiliary SEQUENCE objects to implement identities of tables. These sequences are usually not interesting to client code, which is why they are excluded by default.
  • includeSystemTables: Some databases produce auxiliary TABLE objects to implement other types of tables, such as "virtual tables" (e.g. in SQLite). These implementation tables are usually not interesting for client code, which is why these are excluded by default.
  • includeTriggerRoutines: Some databases store triggers as special ROUTINE types in the schema. These routines are not meant to be called directly, by clients, which is why their inclusion in code generation is undesirable.

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo