Annotation Interface TableName


@Documented @Retention(RUNTIME) @Target(TYPE) @Analyze("org.tentackle.buildsupport.TableNameAnalyzeHandler") public @interface TableName
Annotation for the tablename of a PDO.

The tablename can be modified by the options:

  • mapSchema: if true, dots will be replaced by underscores
  • prefix: prepends given string to each tablename
Those options can be provided as maven properties such as:
      <wurbletProperties>
              <tablePrefix>pls</tablePrefix>
              ...
   
and in the code:
   @TableName(value=/**/"md.ingotcategory"/**/,    // @wurblet < Inject --string $tablename
           mapSchema=/**/false/**/,     // @wurblet < Inject $mapSchema
           prefix=/**/""/**/)       // @wurblet < Inject --string $tablePrefix
  
Means: all schemas get "pls" prepended (for example: "td.message" becomes "plstd.message"). Non-schema tables from the TT-framework (technical tables) remain in the default schema. This configuration is particularly useful for databases like Oracle that emulate schemas via extra users. As a result, the main user "pls" remains unchanged, transaction data goes to the "schema-user" plstd while the master data go to plsmd. The model, however, remains unchanged! It's just a configuration in pom.xml.

With mapSchema=true and prefix="" all tables go to the default schema, while master data tables start with md_ and transaction data with td_.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Determines the tablename.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Determines whether schemas are allowed or mapped to simple table names.
    If true, tablenames like "md.blah" are mapped to "md_blah".
    Adds a prefix to the tablename or schema.
  • Element Details

    • value

      String value
      Determines the tablename.
      Returns:
      the tablename
    • mapSchema

      boolean mapSchema
      Determines whether schemas are allowed or mapped to simple table names.
      If true, tablenames like "md.blah" are mapped to "md_blah". This is especially useful for databases that don't support schemas or provide only quirky workarounds (Oracle, MySQL, for example).
      Returns:
      true if map to non-schema name
      Default:
      false
    • prefix

      String prefix
      Adds a prefix to the tablename or schema.
      Returns:
      the optional prefix
      Default:
      ""