The Spring Framework

org.springframework.jdbc.core.metadata
Class TableMetaDataContext

java.lang.Object
  extended by org.springframework.jdbc.core.metadata.TableMetaDataContext

public class TableMetaDataContext
extends Object

Class to manage context metadata used for the configuration and execution of operations on a database table.

Since:
2.5
Author:
Thomas Risberg

Field Summary
protected  Log logger
          Logger available to subclasses
 
Constructor Summary
TableMetaDataContext()
           
 
Method Summary
 String createInsertString(String[] generatedKeyNames)
          Build the insert string based on configuration and metadata information
 int[] createInsertTypes()
          Build the array of Types based on configuration and metadata information
 String getCatalogName()
          Get the name of the catalog for this context.
 String getSchemaName()
          Get the name of the schema for this context.
 String getSimulationQueryForGetGeneratedKey(String tableName, String keyColumnName)
          Does this database support simple query to retrieve generated keys when the JDBC 3.0 feature is not supported DatabaseMetaData.supportsGetGeneratedKeys()?
 List<String> getTableColumns()
          Get a List of the table column names.
 String getTableName()
          Get the name of the table for this context.
 boolean isAccessTableParameterMetaData()
          Are we accessing table meta data?
 boolean isGeneratedKeysColumnNameArraySupported()
          Is a column name String array for retreiving generated keys supported Connection.createStruct(String, Object[])?
 boolean isGetGeneratedKeysSimulated()
          Does this database support simple query to retrieve generated keys when the JDBC 3.0 feature is not supported DatabaseMetaData.supportsGetGeneratedKeys()?
 boolean isGetGeneratedKeysSupported()
          Does this database support the JDBC 3.0 feature of retreiving generated keys DatabaseMetaData.supportsGetGeneratedKeys()?
 List<Object> matchInParameterValuesWithInsertColumns(Map<String,Object> inParameters)
          Match the provided column names and values with the list of columns used.
 List<Object> 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
 void setAccessTableParameterMetaData(boolean accessTableParameterMetaData)
          Specify whether we should access table column meta data.
 void setCatalogName(String catalogName)
          Set the name of the catalog for this context.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final Log logger
Logger available to subclasses

Constructor Detail

TableMetaDataContext

public TableMetaDataContext()
Method Detail

setTableName

public void setTableName(String tableName)
Set the name of the table for this context.


getTableName

public String getTableName()
Get the name of the table for this context.


setCatalogName

public void setCatalogName(String catalogName)
Set the name of the catalog for this context.


getCatalogName

public String getCatalogName()
Get the name of the catalog for this context.


setSchemaName

public void setSchemaName(String schemaName)
Set the name of the schema for this context.


getSchemaName

public String getSchemaName()
Get the name of the schema for this context.


setAccessTableParameterMetaData

public void setAccessTableParameterMetaData(boolean accessTableParameterMetaData)
Specify whether we should access table column meta data.


isAccessTableParameterMetaData

public boolean isAccessTableParameterMetaData()
Are we accessing table meta data?


getTableColumns

public List<String> getTableColumns()
Get a List of the table column names.


isGetGeneratedKeysSupported

public boolean isGetGeneratedKeysSupported()
Does this database support the JDBC 3.0 feature of retreiving 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()?


getSimulationQueryForGetGeneratedKey

public String getSimulationQueryForGetGeneratedKey(String tableName,
                                                   String keyColumnName)
Does this database support 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 retreiving generated keys supported Connection.createStruct(String, Object[])?


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 used
declaredColumns - any coluns that are declared
generatedKeyNames - name of generated keys

matchInParameterValuesWithInsertColumns

public List<Object> matchInParameterValuesWithInsertColumns(SqlParameterSource parameterSource)
Match the provided column names and values with the list of columns used.

Parameters:
parameterSource - the parameter names and values

matchInParameterValuesWithInsertColumns

public List<Object> matchInParameterValuesWithInsertColumns(Map<String,Object> inParameters)
Match the provided column names and values with the list of columns used.

Parameters:
inParameters - the parameter names and values

createInsertString

public String createInsertString(String[] generatedKeyNames)
Build the insert string based on configuration and metadata information

Returns:
the insert string to be used

createInsertTypes

public int[] createInsertTypes()
Build the array of Types based on configuration and metadata information

Returns:
the array of types to be used

The Spring Framework

Copyright © 2002-2008 The Spring Framework.