Class TableMetaDataContext
java.lang.Object
org.springframework.jdbc.core.metadata.TableMetaDataContext
Class to manage context meta-data used for the configuration
and execution of operations on a database table.
- Since:
- 2.5
- Author:
- Thomas Risberg, Juergen Hoeller, Sam Brannen
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateInsertString
(String... generatedKeyNames) Build the insert string based on configuration and meta-data information.int[]
Build the array ofTypes
based on configuration and meta-data information.Get the name of the catalog for this context.Get the name of the schema for this context.getSimpleQueryForGetGeneratedKey
(String tableName, String keyColumnName) Does this database support a simple query to retrieve generated keys when the JDBC 3.0 feature is not supported:DatabaseMetaData.supportsGetGeneratedKeys()
?Get a List of the table column names.Get the name of the table for this context.boolean
Are we accessing table meta-data?boolean
Is a column name String array for retrieving generated keys supported:Connection.createStruct(String, Object[])
?boolean
Does this database support simple query to retrieve generated keys when the JDBC 3.0 feature is not supported:DatabaseMetaData.supportsGetGeneratedKeys()
?boolean
Does this database support the JDBC 3.0 feature of retrieving generated keys:DatabaseMetaData.supportsGetGeneratedKeys()
?boolean
Are we overriding include synonyms default?matchInParameterValuesWithInsertColumns
(Map<String, ?> inParameters) Match the provided column names and values with the list of columns used.matchInParameterValuesWithInsertColumns
(SqlParameterSource parameterSource) Match the provided column names and values with the list of columns used.void
processMetaData
(DataSource dataSource, List<String> declaredColumns, String[] generatedKeyNames) Process the current meta-data with the provided configuration options.reconcileColumnsToUse
(List<String> declaredColumns, String[] generatedKeyNames) Compare columns created from meta-data with declared columns and return a reconciled list.void
setAccessTableColumnMetaData
(boolean accessTableColumnMetaData) Specify whether we should access table column meta-data.void
setCatalogName
(String catalogName) Set the name of the catalog for this context.void
setOverrideIncludeSynonymsDefault
(boolean override) Specify whether we should override default for accessing synonyms.void
setSchemaName
(String schemaName) Set the name of the schema for this context.void
setTableName
(String tableName) Set the name of the table for this context.
-
Field Details
-
logger
-
-
Constructor Details
-
TableMetaDataContext
public TableMetaDataContext()
-
-
Method Details
-
setTableName
Set the name of the table for this context. -
getTableName
Get the name of the table for this context. -
setCatalogName
Set the name of the catalog for this context. -
getCatalogName
Get the name of the catalog for this context. -
setSchemaName
Set the name of the schema for this context. -
getSchemaName
Get the name of the schema for this context. -
setAccessTableColumnMetaData
public void setAccessTableColumnMetaData(boolean accessTableColumnMetaData) Specify whether we should access table column meta-data. -
isAccessTableColumnMetaData
public boolean isAccessTableColumnMetaData()Are we accessing table meta-data? -
setOverrideIncludeSynonymsDefault
public void setOverrideIncludeSynonymsDefault(boolean override) Specify whether we should override default for accessing synonyms. -
isOverrideIncludeSynonymsDefault
public boolean isOverrideIncludeSynonymsDefault()Are we overriding include synonyms default? -
getTableColumns
Get a List of the table column names. -
processMetaData
public void processMetaData(DataSource dataSource, List<String> declaredColumns, String[] generatedKeyNames) Process the current meta-data with the provided configuration options.- Parameters:
dataSource
- the DataSource being useddeclaredColumns
- any columns that are declaredgeneratedKeyNames
- name of generated keys
-
reconcileColumnsToUse
protected List<String> reconcileColumnsToUse(List<String> declaredColumns, String[] generatedKeyNames) Compare columns created from meta-data with declared columns and return a reconciled list.- Parameters:
declaredColumns
- declared column namesgeneratedKeyNames
- names of generated key columns
-
matchInParameterValuesWithInsertColumns
Match the provided column names and values with the list of columns used.- Parameters:
parameterSource
- the parameter names and values
-
matchInParameterValuesWithInsertColumns
Match the provided column names and values with the list of columns used.- Parameters:
inParameters
- the parameter names and values
-
createInsertString
Build the insert string based on configuration and meta-data information.- Returns:
- the insert string to be used
-
createInsertTypes
public int[] createInsertTypes()Build the array ofTypes
based on configuration and meta-data information.- Returns:
- the array of types to be used
-
isGetGeneratedKeysSupported
public boolean isGetGeneratedKeysSupported()Does this database support the JDBC 3.0 feature of retrieving generated keys:DatabaseMetaData.supportsGetGeneratedKeys()
? -
isGetGeneratedKeysSimulated
public boolean isGetGeneratedKeysSimulated()Does this database support simple query to retrieve generated keys when the JDBC 3.0 feature is not supported:DatabaseMetaData.supportsGetGeneratedKeys()
? -
getSimpleQueryForGetGeneratedKey
Does this database support a simple query to retrieve generated keys when the JDBC 3.0 feature is not supported:DatabaseMetaData.supportsGetGeneratedKeys()
? -
isGeneratedKeysColumnNameArraySupported
public boolean isGeneratedKeysColumnNameArraySupported()Is a column name String array for retrieving generated keys supported:Connection.createStruct(String, Object[])
?
-