public class

GenericTableMetaDataProvider

extends Object
implements TableMetaDataProvider
java.lang.Object
   ↳ org.springframework.jdbc.core.metadata.GenericTableMetaDataProvider
Known Direct Subclasses

Class Overview

A generic implementation of the TableMetaDataProvider that should provide enough features for all supported databases.

Summary

Fields
protected static final Log logger Logger available to subclasses
Protected Constructors
GenericTableMetaDataProvider(DatabaseMetaData databaseMetaData)
Constructor used to initialize with provided database meta data.
Public Methods
String catalogNameToUse(String catalogName)
Get the catalog name formatted based on metadata information.
String getSimpleQueryForGetGeneratedKey(String tableName, String keyColumnName)
Get the simple query to retrieve a generated key
List<TableParameterMetaData> getTableParameterMetaData()
Get the table parameter metadata that is currently used.
void initializeWithMetaData(DatabaseMetaData databaseMetaData)
Initialize using the database metedata provided
void initializeWithTableColumnMetaData(DatabaseMetaData databaseMetaData, String catalogName, String schemaName, String tableName)
Initialize using provided database metadata, table and column information.
boolean isGeneratedKeysColumnNameArraySupported()
Does this database support a column name String array for retreiving generated keys createStruct(String, Object[])
boolean isGetGeneratedKeysSimulated()
Does this database support a simple quey to retrieve the generated key whe the JDBC 3.0 feature of retreiving generated keys is not supported supportsGetGeneratedKeys()
boolean isGetGeneratedKeysSupported()
Does this database support the JDBC 3.0 feature of retreiving generated keys supportsGetGeneratedKeys()
boolean isStoresLowerCaseIdentifiers()
Get whether identifiers use lower case
boolean isStoresUpperCaseIdentifiers()
Get whether identifiers use upper case
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 metadata information.
void setGeneratedKeysColumnNameArraySupported(boolean generatedKeysColumnNameArraySupported)
Specify whether a column name array is supported for generated keys
void setGetGeneratedKeysSupported(boolean getGeneratedKeysSupported)
Specify whether a column name array is supported for generated keys
void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor)
Set the NativeJdbcExtractor to use to retrieve the native connection if necessary
void setStoresLowerCaseIdentifiers(boolean storesLowerCaseIdentifiers)
Specify whether identifiers use lower case.
void setStoresUpperCaseIdentifiers(boolean storesUpperCaseIdentifiers)
Specify whether identifiers use upper case
String tableNameToUse(String tableName)
Get the table name formatted based on metadata information.
Protected Methods
String getDatabaseVersion()
Provide access to version info for subclasses.
NativeJdbcExtractor getNativeJdbcExtractor()
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.jdbc.core.metadata.TableMetaDataProvider

Fields

protected static final Log logger

Logger available to subclasses

Protected Constructors

protected GenericTableMetaDataProvider (DatabaseMetaData databaseMetaData)

Constructor used to initialize with provided database meta data.

Parameters
databaseMetaData meta data to be used
Throws
SQLException

Public Methods

public String catalogNameToUse (String catalogName)

Get the catalog name formatted based on metadata information. This could include altering the case.

Returns
  • catalog name formatted

public String getSimpleQueryForGetGeneratedKey (String tableName, String keyColumnName)

Get the simple query to retrieve a generated key

public List<TableParameterMetaData> getTableParameterMetaData ()

Get the table parameter metadata that is currently used.

Returns

public void initializeWithMetaData (DatabaseMetaData databaseMetaData)

Initialize using the database metedata provided

Throws
SQLException

public void initializeWithTableColumnMetaData (DatabaseMetaData databaseMetaData, String catalogName, String schemaName, String tableName)

Initialize using provided database metadata, table and column information. This initalization can be turned off by specifying that column meta data should not be used.

Parameters
databaseMetaData used to retrieve database specific information
catalogName name of catalog to use or null
schemaName name of schema name to use or null
tableName name of the table
Throws
SQLException

public boolean isGeneratedKeysColumnNameArraySupported ()

Does this database support a column name String array for retreiving generated keys createStruct(String, Object[])

public boolean isGetGeneratedKeysSimulated ()

Does this database support a simple quey to retrieve the generated key whe the JDBC 3.0 feature of retreiving generated keys is not supported supportsGetGeneratedKeys()

public boolean isGetGeneratedKeysSupported ()

Does this database support the JDBC 3.0 feature of retreiving generated keys supportsGetGeneratedKeys()

public boolean isStoresLowerCaseIdentifiers ()

Get whether identifiers use lower case

public boolean isStoresUpperCaseIdentifiers ()

Get whether identifiers use upper case

public boolean isTableColumnMetaDataUsed ()

Are we using the meta data for the table columns?

public String metaDataCatalogNameToUse (String catalogName)

Provide any modification of the catalog name passed in to match the meta data currently used. The reyurned value will be used for meta data lookups. This could include alterig the case used or providing a base catalog if mone provided.

Returns
  • catalog name to use

public String metaDataSchemaNameToUse (String schemaName)

Provide any modification of the schema name passed in to match the meta data currently used. The reyurned value will be used for meta data lookups. This could include alterig the case used or providing a base schema if mone provided.

Returns
  • schema name to use

public String schemaNameToUse (String schemaName)

Get the schema name formatted based on metadata information. This could include altering the case.

Returns
  • schema name formatted

public void setGeneratedKeysColumnNameArraySupported (boolean generatedKeysColumnNameArraySupported)

Specify whether a column name array is supported for generated keys

public void setGetGeneratedKeysSupported (boolean getGeneratedKeysSupported)

Specify whether a column name array is supported for generated keys

public void setNativeJdbcExtractor (NativeJdbcExtractor nativeJdbcExtractor)

Set the NativeJdbcExtractor to use to retrieve the native connection if necessary

public void setStoresLowerCaseIdentifiers (boolean storesLowerCaseIdentifiers)

Specify whether identifiers use lower case.

public void setStoresUpperCaseIdentifiers (boolean storesUpperCaseIdentifiers)

Specify whether identifiers use upper case

public String tableNameToUse (String tableName)

Get the table name formatted based on metadata information. This could include altering the case.

Returns
  • table name formatted

Protected Methods

protected String getDatabaseVersion ()

Provide access to version info for subclasses.

protected NativeJdbcExtractor getNativeJdbcExtractor ()