All versions: 3.11 | 3.10 | 3.9 | 3.8 | 3.7 | Development versions: 3.12 | Unsupported versions: 3.6 | 3.5 | 3.4 | 3.3 | 3.2 | 2.6

Mapping generated catalogs and schemas

We've seen previously in the chapter about runtime schema mapping, that catalogs, schemata and tables can be mapped at runtime to other names. But you can also hard-wire catalog and schema mapping in generated artefacts at code generation time, e.g. when you have 5 developers with their own dedicated developer databases, and a common integration database. In the code generation configuration, you would then write.

Schema mapping

The following configuration applies mapping only for schemata, not for catalogs. The <schemata/> element is a standalone element that can be put in the code generator's <database/> configuration element:

<schemata>
  <schema>
    <!-- Use this as the developer's schema: -->
    <inputSchema>LUKAS_DEV_SCHEMA</inputSchema>

    <!-- Use this as the integration / production database: -->
    <outputSchema>PROD</outputSchema>
  </schema>
</schemata>

The following configuration applies mapping for catalogs and their schemata. The <catalogs/> element is a standalone element that can be put in the code generator's <database/> configuration element:

<catalogs>
  <catalog>
    <!-- Use this as the developer's catalog: -->
    <inputCatalog>LUKAS_DEV_CATALOG</inputCatalog>

    <!-- Use this as the integration / production database: -->
    <outputCatalog>PROD</outputCatalog>
    
    <!-- Optionally, nest also schema mapping configurations: -->
    <schemata>
      ...
    </schemata>
  </catalog>
</catalogs>
The jOOQ Logo