org.springframework.jdbc.core.metadata

## Class GenericTableMetaDataProvider

- java.lang.Object
- - org.springframework.jdbc.core.metadata.GenericTableMetaDataProvider

- All Implemented Interfaces:
    TableMetaDataProvider
  Direct Known Subclasses:
    DerbyTableMetaDataProvider, HsqlTableMetaDataProvider, OracleTableMetaDataProvider, PostgresTableMetaDataProvider

      public class GenericTableMetaDataProvider
      extends Object
      implements TableMetaDataProvider

  A generic implementation of the `TableMetaDataProvider` interface which should provide enough features for all supported databases.
  Since:
    2.5
  Author:
    Thomas Risberg, Juergen Hoeller, Sam Brannen

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static Log` | `logger` Logger available to subclasses.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `GenericTableMetaDataProvider(DatabaseMetaData databaseMetaData)` Constructor used to initialize with provided database meta-data.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `catalogNameToUse(String catalogName)` Get the catalog name formatted based on meta-data information.
    `protected String` | `getDatabaseVersion()` Provide access to version info for subclasses.
    `protected String` | `getDefaultSchema()` Provide access to default schema for subclasses.
    `String` | `getSimpleQueryForGetGeneratedKey(String tableName, String keyColumnName)` Get the simple query to retrieve a generated key.
    `List<TableParameterMetaData>` | `getTableParameterMetaData()` Get the table parameter meta-data that is currently used.
    `void` | `initializeWithMetaData(DatabaseMetaData databaseMetaData)` Initialize using the database meta-data provided.
    `void` | `initializeWithTableColumnMetaData(DatabaseMetaData databaseMetaData, String catalogName, String schemaName, String tableName)` Initialize using provided database meta-data, table and column information.
    `boolean` | `isGeneratedKeysColumnNameArraySupported()` Does this database support a column name String array for retrieving generated keys: `Connection.createStruct(String, Object[])`?
    `boolean` | `isGetGeneratedKeysSimulated()` Does this database support a simple query to retrieve the generated key when the JDBC 3.0 feature of retrieving generated keys is not supported?
    `boolean` | `isGetGeneratedKeysSupported()` Does this database support the JDBC 3.0 feature of retrieving generated keys: `DatabaseMetaData.supportsGetGeneratedKeys()`?
    `boolean` | `isStoresLowerCaseIdentifiers()`
    `boolean` | `isStoresUpperCaseIdentifiers()`
    `boolean` | `isTableColumnMetaDataUsed()` Are we using the meta-data for the table columns?
    `String` | `metaDataCatalogNameToUse(String catalogName)` Provide any modification of the catalog name passed in to match the meta-data currently used.
    `String` | `metaDataSchemaNameToUse(String schemaName)` Provide any modification of the schema name passed in to match the meta-data currently used.
    `String` | `schemaNameToUse(String schemaName)` Get the schema name formatted based on meta-data information.
    `void` | `setGeneratedKeysColumnNameArraySupported(boolean generatedKeysColumnNameArraySupported)`
    `void` | `setGetGeneratedKeysSupported(boolean getGeneratedKeysSupported)`
    `void` | `setStoresLowerCaseIdentifiers(boolean storesLowerCaseIdentifiers)`
    `void` | `setStoresUpperCaseIdentifiers(boolean storesUpperCaseIdentifiers)`
    `String` | `tableNameToUse(String tableName)` Get the table name formatted based on meta-data information.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### logger

          protected static final Log logger

      Logger available to subclasses.

  - ### Constructor Detail

    - #### GenericTableMetaDataProvider

          protected GenericTableMetaDataProvider(DatabaseMetaData databaseMetaData)
                                          throws SQLException

      Constructor used to initialize with provided database meta-data.
      Parameters:
        `databaseMetaData` - meta-data to be used
      Throws:
        `SQLException`

  - ### Method Detail

    - #### setStoresUpperCaseIdentifiers

          public void setStoresUpperCaseIdentifiers(boolean storesUpperCaseIdentifiers)

    - #### isStoresUpperCaseIdentifiers

          public boolean isStoresUpperCaseIdentifiers()

    - #### setStoresLowerCaseIdentifiers

          public void setStoresLowerCaseIdentifiers(boolean storesLowerCaseIdentifiers)

    - #### isStoresLowerCaseIdentifiers

          public boolean isStoresLowerCaseIdentifiers()

    - #### isTableColumnMetaDataUsed

          public boolean isTableColumnMetaDataUsed()

      Description copied from interface: `TableMetaDataProvider`
      Are we using the meta-data for the table columns?
      Specified by:
        `isTableColumnMetaDataUsed` in interface `TableMetaDataProvider`

    - #### getTableParameterMetaData

          public List<TableParameterMetaData> getTableParameterMetaData()

      Description copied from interface: `TableMetaDataProvider`
      Get the table parameter meta-data that is currently used.
      Specified by:
        `getTableParameterMetaData` in interface `TableMetaDataProvider`
      Returns:
        a List of `TableParameterMetaData`

    - #### isGetGeneratedKeysSupported

          public boolean isGetGeneratedKeysSupported()

      Description copied from interface: `TableMetaDataProvider`
      Does this database support the JDBC 3.0 feature of retrieving generated keys: `DatabaseMetaData.supportsGetGeneratedKeys()`?
      Specified by:
        `isGetGeneratedKeysSupported` in interface `TableMetaDataProvider`

    - #### isGetGeneratedKeysSimulated

          public boolean isGetGeneratedKeysSimulated()

      Description copied from interface: `TableMetaDataProvider`
      Does this database support a simple query to retrieve the generated key when the JDBC 3.0 feature of retrieving generated keys is not supported?
      Specified by:
        `isGetGeneratedKeysSimulated` in interface `TableMetaDataProvider`
      See Also:
        `TableMetaDataProvider.isGetGeneratedKeysSupported()`

    - #### getSimpleQueryForGetGeneratedKey

          @Nullable
          public String getSimpleQueryForGetGeneratedKey(String tableName,
                                                                   String keyColumnName)

      Description copied from interface: `TableMetaDataProvider`
      Get the simple query to retrieve a generated key.
      Specified by:
        `getSimpleQueryForGetGeneratedKey` in interface `TableMetaDataProvider`

    - #### setGetGeneratedKeysSupported

          public void setGetGeneratedKeysSupported(boolean getGeneratedKeysSupported)

    - #### setGeneratedKeysColumnNameArraySupported

          public void setGeneratedKeysColumnNameArraySupported(boolean generatedKeysColumnNameArraySupported)

    - #### isGeneratedKeysColumnNameArraySupported

          public boolean isGeneratedKeysColumnNameArraySupported()

      Description copied from interface: `TableMetaDataProvider`
      Does this database support a column name String array for retrieving generated keys: `Connection.createStruct(String, Object[])`?
      Specified by:
        `isGeneratedKeysColumnNameArraySupported` in interface `TableMetaDataProvider`

    - #### initializeWithMetaData

          public void initializeWithMetaData(DatabaseMetaData databaseMetaData)
                                      throws SQLException

      Description copied from interface: `TableMetaDataProvider`
      Initialize using the database meta-data provided.
      Specified by:
        `initializeWithMetaData` in interface `TableMetaDataProvider`
      Parameters:
        `databaseMetaData` - used to retrieve database specific information
      Throws:
        `SQLException` - in case of initialization failure

    - #### initializeWithTableColumnMetaData

          public void initializeWithTableColumnMetaData(DatabaseMetaData databaseMetaData,
                                                        @Nullable
                                                        String catalogName,
                                                        @Nullable
                                                        String schemaName,
                                                        @Nullable
                                                        String tableName)
                                                 throws SQLException

      Description copied from interface: `TableMetaDataProvider`
      Initialize using provided database meta-data, table and column information. This initialization can be turned off by specifying that column meta-data should not be used.
      Specified by:
        `initializeWithTableColumnMetaData` in interface `TableMetaDataProvider`
      Parameters:
        `databaseMetaData` - used to retrieve database specific information
        `catalogName` - name of catalog to use (or `null` if none)
        `schemaName` - name of schema name to use (or `null` if none)
        `tableName` - name of the table
      Throws:
        `SQLException` - in case of initialization failure

    - #### tableNameToUse

          @Nullable
          public String tableNameToUse(@Nullable
                                                 String tableName)

      Description copied from interface: `TableMetaDataProvider`
      Get the table name formatted based on meta-data information. This could include altering the case.
      Specified by:
        `tableNameToUse` in interface `TableMetaDataProvider`

    - #### catalogNameToUse

          @Nullable
          public String catalogNameToUse(@Nullable
                                                   String catalogName)

      Description copied from interface: `TableMetaDataProvider`
      Get the catalog name formatted based on meta-data information. This could include altering the case.
      Specified by:
        `catalogNameToUse` in interface `TableMetaDataProvider`

    - #### schemaNameToUse

          @Nullable
          public String schemaNameToUse(@Nullable
                                                  String schemaName)

      Description copied from interface: `TableMetaDataProvider`
      Get the schema name formatted based on meta-data information. This could include altering the case.
      Specified by:
        `schemaNameToUse` in interface `TableMetaDataProvider`

    - #### metaDataCatalogNameToUse

          @Nullable
          public String metaDataCatalogNameToUse(@Nullable
                                                           String catalogName)

      Description copied from interface: `TableMetaDataProvider`
      Provide any modification of the catalog name passed in to match the meta-data currently used. The returned value will be used for meta-data lookups. This could include altering the case used or providing a base catalog if none is provided.
      Specified by:
        `metaDataCatalogNameToUse` in interface `TableMetaDataProvider`

    - #### metaDataSchemaNameToUse

          @Nullable
          public String metaDataSchemaNameToUse(@Nullable
                                                          String schemaName)

      Description copied from interface: `TableMetaDataProvider`
      Provide any modification of the schema name passed in to match the meta-data currently used. The returned value will be used for meta-data lookups. This could include altering the case used or providing a base schema if none is provided.
      Specified by:
        `metaDataSchemaNameToUse` in interface `TableMetaDataProvider`

    - #### getDefaultSchema

          @Nullable
          protected String getDefaultSchema()

      Provide access to default schema for subclasses.

    - #### getDatabaseVersion

          @Nullable
          protected String getDatabaseVersion()

      Provide access to version info for subclasses.