Module org.jooq
Package org.jooq

Class SchemaMapping

java.lang.Object
org.jooq.SchemaMapping
All Implemented Interfaces:
Serializable

@Deprecated(forRemoval=true, since="2.0") public class SchemaMapping extends Object implements Serializable
Deprecated, for removal: This API element is subject to removal in a future version.
- 2.0.5 - Use runtime configuration Settings instead
General mapping of generated artefacts onto run-time substitutes.

There are several use cases, when the run-time schema configuration may be different from the compile-time (or code-generation-time) schema configuration. Say, you develop a schema called DEV. It contains a table DEV.T. When you install your database on a productive system, you might have two schemata:

  • PROD: The productive schema. It contains the table PROD.T
  • BACKUP: The productive backup schema. This schema might be shared with other applications, so you might have table name collisions. Therefore, you'd want to map your table DEV.T onto BACKUP.MY_T

This can be achieved with the SchemaMapping, where you can map schemata and tables, for them to render different names at run-time, than at compile-time.

Since:
1.5.2, 1.6.0
Author:
Lukas Eder
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
    Construct a mapping from a Configuration object
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(String inputSchema, String outputSchema)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Add schemata to this mapping
    void
    add(String inputSchema, Schema outputSchema)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Add schemata to this mapping
    void
    add(Schema inputSchema, String outputSchema)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Add schemata to this mapping
    void
    add(Schema inputSchema, Schema outputSchema)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Add schemata to this mapping
    void
    add(Table<?> inputTable, String outputTable)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Add tables to this mapping
    void
    add(Table<?> inputTable, Table<?> outputTable)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Add tables to this mapping
    @Nullable Catalog
    map(Catalog catalog)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    @Nullable Schema
    map(Schema schema)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Apply mapping to a given schema
    <R extends Record>
    @Nullable Table<R>
    map(Table<R> table)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Apply mapping to a given table
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Synonym for use(String).
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Initialise SchemaMapping.
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    use(String schemaName)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set a schema as the default schema.
    void
    use(Schema schema)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set a schema as the default schema.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SchemaMapping

      public SchemaMapping(Configuration configuration)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Construct a mapping from a Configuration object
  • Method Details

    • use

      public void use(Schema schema)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set a schema as the default schema. This results in the supplied schema being omitted in generated SQL.

      If the supplied mapping has already been added using add(Schema, Schema), then use() has no effect.

      Parameters:
      schema - the default schema
    • use

      public void use(String schemaName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set a schema as the default schema. This results in the supplied schema being omitted in generated SQL.

      If the supplied mapping has already been added using add(Schema, Schema), then use() has no effect.

      Parameters:
      schemaName - the default schema
    • add

      public void add(String inputSchema, String outputSchema)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Add schemata to this mapping
      Parameters:
      inputSchema - The schema known at codegen time to be mapped
      outputSchema - The schema configured at run time to be mapped
    • add

      public void add(String inputSchema, Schema outputSchema)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Add schemata to this mapping
      Parameters:
      inputSchema - The schema known at codegen time to be mapped
      outputSchema - The schema configured at run time to be mapped
    • add

      public void add(Schema inputSchema, Schema outputSchema)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Add schemata to this mapping
      Parameters:
      inputSchema - The schema known at codegen time to be mapped
      outputSchema - The schema configured at run time to be mapped
    • add

      public void add(Schema inputSchema, String outputSchema)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Add schemata to this mapping
      Parameters:
      inputSchema - The schema known at codegen time to be mapped
      outputSchema - The schema configured at run time to be mapped
    • add

      public void add(Table<?> inputTable, Table<?> outputTable)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Add tables to this mapping
      Parameters:
      inputTable - The table known at codegen time to be mapped
      outputTable - The table configured at run time to be mapped
    • add

      public void add(Table<?> inputTable, String outputTable)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Add tables to this mapping
      Parameters:
      inputTable - The table known at codegen time to be mapped
      outputTable - The table configured at run time to be mapped
    • map

      @Nullable public @Nullable Catalog map(Catalog catalog)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • map

      @Nullable public @Nullable Schema map(Schema schema)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Apply mapping to a given schema
      Parameters:
      schema - The schema to be mapped
      Returns:
      The configured schema
    • map

      @Nullable public <R extends Record> @Nullable Table<R> map(Table<R> table)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Apply mapping to a given table
      Parameters:
      table - The generated table to be mapped
      Returns:
      The configured table
    • setDefaultSchema

      public void setDefaultSchema(String schema)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Synonym for use(String). Added for better interoperability with Spring
    • setSchemaMapping

      public void setSchemaMapping(Map<String,String> schemaMap)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Initialise SchemaMapping. Added for better interoperability with Spring
    • toString

      public String toString()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      toString in class Object