Top Description Fields Constructors Methods
org.springframework.jdbc.core.metadata

public Class GenericCallMetaDataProvider

extends Object
implements CallMetaDataProvider
Class Inheritance
All Implemented Interfaces
org.springframework.jdbc.core.metadata.CallMetaDataProvider
Known Direct Subclasses
org.springframework.jdbc.core.metadata.HanaCallMetaDataProvider, org.springframework.jdbc.core.metadata.OracleCallMetaDataProvider, org.springframework.jdbc.core.metadata.PostgresCallMetaDataProvider, org.springframework.jdbc.core.metadata.SqlServerCallMetaDataProvider, org.springframework.jdbc.core.metadata.SybaseCallMetaDataProvider, org.springframework.jdbc.core.metadata.Db2CallMetaDataProvider, org.springframework.jdbc.core.metadata.DerbyCallMetaDataProvider
Imports
java.sql.DatabaseMetaData, .ResultSet, .SQLException, .Types, java.util.ArrayList, .List, .Objects, org.apache.commons.logging.Log, .LogFactory, org.springframework.dao.InvalidDataAccessApiUsageException, org.springframework.jdbc.core.SqlInOutParameter, .SqlOutParameter, .SqlParameter, org.springframework.lang.Nullable, org.springframework.util.StringUtils

A generic implementation of the CallMetaDataProvider interface.

This class can be extended to provide database specific behavior.

Authors
Thomas Risberg, Juergen Hoeller, Sam Brannen, Stephane Nicoll
Since
2.5

Field Summary

Modifier and TypeField and Description
private final List<CallParameterMetaData>
protected static final Log
logger

Logger available to subclasses.

private boolean
private boolean
private boolean
private boolean
private boolean
private final String

Constructor Summary

AccessConstructor and Description
protected
GenericCallMetaDataProvider(DatabaseMetaData
meta-data to be used
databaseMetaData
)

Constructor used to initialize with provided database meta-data.

Method Summary

Modifier and TypeMethod and Description
public boolean
byPassReturnParameter(String parameterName)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.byPassReturnParameter.

Should we bypass the return parameter with the specified name?
public String
catalogNameToUse(String catalogName)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.catalogNameToUse.

Provide any modification of the catalog name passed in to match the meta-data currently used.
public SqlParameter
createDefaultInOutParameter(String
the name of the parameter
parameterName
,
CallParameterMetaData
meta-data used for this call
meta
)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.createDefaultInOutParameter.

Create a default in/out parameter based on the provided meta-data.
public SqlParameter
createDefaultInParameter(String
the name of the parameter
parameterName
,
CallParameterMetaData
meta-data used for this call
meta
)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.createDefaultInParameter.

Create a default in parameter based on the provided meta-data.
public SqlParameter
createDefaultOutParameter(String
the name of the parameter
parameterName
,
CallParameterMetaData
meta-data used for this call
meta
)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.createDefaultOutParameter.

Create a default out parameter based on the provided meta-data.
private static String
public List<CallParameterMetaData>
getCallParameterMetaData()

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.getCallParameterMetaData.

Get the call parameter meta-data that is currently used.
public int
getRefCursorSqlType()

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.getRefCursorSqlType.

Get the java.sql.Types type for columns that return ResultSets as ref cursors if this feature is supported.
public String
private String
identifierNameToUse(String identifierName)

public void
initializeWithMetaData(DatabaseMetaData
used to retrieve database specific information
databaseMetaData
)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.initializeWithMetaData.

Initialize using the provided DatabaseMetData.
public void
initializeWithProcedureColumnMetaData(DatabaseMetaData
used to retrieve database specific information
databaseMetaData
,
String
name of catalog to use (or null if none)
catalogName
,
String
name of schema name to use (or null if none)
schemaName
,
String
name of the stored procedure
procedureName
)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.initializeWithProcedureColumnMetaData.

Initialize the database specific management of procedure column meta-data.
private static boolean
isInOrOutColumn(int columnType, boolean function)

public boolean
public boolean
isRefCursorSupported()

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.isRefCursorSupported.

Does this database support returning ResultSets as ref cursors to be retrieved with java.sql.CallableStatement#getObject(int) for the specified column?
public boolean
isReturnResultSetSupported()

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.isReturnResultSetSupported.

Does this database support returning ResultSets that should be retrieved with the JDBC call: java.sql.Statement#getResultSet()?
protected boolean
isStoresLowerCaseIdentifiers()

Does the database use lower case for identifiers?

protected boolean
isStoresUpperCaseIdentifiers()

Does the database use upper case for identifiers?

public boolean
public boolean
isSupportsSchemasInProcedureCalls()

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.isSupportsSchemasInProcedureCalls.

Does the database support the use of schema name in procedure calls?
public String
metaDataCatalogNameToUse(String catalogName)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.metaDataCatalogNameToUse.

Provide any modification of the catalog name passed in to match the meta-data currently used.
public String
metaDataSchemaNameToUse(String schemaName)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.metaDataSchemaNameToUse.

Provide any modification of the schema name passed in to match the meta-data currently used.
public String
namedParameterBindingToUse(String
the name of the parameter to bind
parameterName
)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.namedParameterBindingToUse.

Return the name of the named parameter to use for binding the given parameter name.
public String
parameterNameToUse(String
name of the parameter of column
parameterName
)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.parameterNameToUse.

Provide any modification of the column name passed in to match the meta-data currently used.
public String
procedureNameToUse(String procedureName)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.procedureNameToUse.

Provide any modification of the procedure name passed in to match the meta-data currently used.
private void
processProcedureColumns(DatabaseMetaData databaseMetaData, String catalogName, String schemaName, String procedureName)

Process the procedure column meta-data.

public String
schemaNameToUse(String schemaName)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.schemaNameToUse.

Provide any modification of the schema name passed in to match the meta-data currently used.
protected void
setStoresLowerCaseIdentifiers(boolean storesLowerCaseIdentifiers)

Specify whether the database uses lower case for identifiers.

protected void
setStoresUpperCaseIdentifiers(boolean storesUpperCaseIdentifiers)

Specify whether the database uses upper case for identifiers.

protected void
setSupportsCatalogsInProcedureCalls(boolean supportsCatalogsInProcedureCalls)

Specify whether the database supports the use of catalog name in procedure calls.

protected void
setSupportsSchemasInProcedureCalls(boolean supportsSchemasInProcedureCalls)

Specify whether the database supports the use of schema name in procedure calls.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

callParameterMetaDataback to summary
private final List<CallParameterMetaData> callParameterMetaData
loggerback to summary
protected static final Log logger

Logger available to subclasses.

procedureColumnMetaDataUsedback to summary
private boolean procedureColumnMetaDataUsed
storesLowerCaseIdentifiersback to summary
private boolean storesLowerCaseIdentifiers
storesUpperCaseIdentifiersback to summary
private boolean storesUpperCaseIdentifiers
supportsCatalogsInProcedureCallsback to summary
private boolean supportsCatalogsInProcedureCalls
supportsSchemasInProcedureCallsback to summary
private boolean supportsSchemasInProcedureCalls
userNameback to summary
private final String userName

Constructor Detail

GenericCallMetaDataProviderback to summary
protected GenericCallMetaDataProvider(DatabaseMetaData databaseMetaData) throws SQLException

Constructor used to initialize with provided database meta-data.

Parameters
databaseMetaData:DatabaseMetaData

meta-data to be used

Method Detail

byPassReturnParameterback to summary
public boolean byPassReturnParameter(String parameterName)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.byPassReturnParameter.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.byPassReturnParameter.

Should we bypass the return parameter with the specified name?

This allows the database specific implementation to skip the processing for specific results returned by the database call.

Annotations
@Override
catalogNameToUseback to summary
public String catalogNameToUse(String catalogName)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.catalogNameToUse.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.catalogNameToUse.

Provide any modification of the catalog name passed in to match the meta-data currently used.

This could include altering the case.

Annotations
@Override
@Nullable
createDefaultInOutParameterback to summary
public SqlParameter createDefaultInOutParameter(String parameterName, CallParameterMetaData meta)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.createDefaultInOutParameter.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.createDefaultInOutParameter.

Create a default in/out parameter based on the provided meta-data.

This is used when no explicit parameter declaration has been made.

Parameters
parameterName:String

the name of the parameter

meta:CallParameterMetaData

meta-data used for this call

Returns:SqlParameter

the configured SqlInOutParameter

Annotations
@Override
createDefaultInParameterback to summary
public SqlParameter createDefaultInParameter(String parameterName, CallParameterMetaData meta)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.createDefaultInParameter.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.createDefaultInParameter.

Create a default in parameter based on the provided meta-data.

This is used when no explicit parameter declaration has been made.

Parameters
parameterName:String

the name of the parameter

meta:CallParameterMetaData

meta-data used for this call

Returns:SqlParameter

the configured SqlParameter

Annotations
@Override
createDefaultOutParameterback to summary
public SqlParameter createDefaultOutParameter(String parameterName, CallParameterMetaData meta)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.createDefaultOutParameter.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.createDefaultOutParameter.

Create a default out parameter based on the provided meta-data.

This is used when no explicit parameter declaration has been made.

Parameters
parameterName:String

the name of the parameter

meta:CallParameterMetaData

meta-data used for this call

Returns:SqlParameter

the configured SqlOutParameter

Annotations
@Override
escapeNamePatternback to summary
private static String escapeNamePattern(String name, String escape)
Annotations
@Nullable
getCallParameterMetaDataback to summary
public List<CallParameterMetaData> getCallParameterMetaData()

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.getCallParameterMetaData.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.getCallParameterMetaData.

Get the call parameter meta-data that is currently used.

Returns:List<CallParameterMetaData>

a List of CallParameterMetaData

Annotations
@Override
getRefCursorSqlTypeback to summary
public int getRefCursorSqlType()

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.getRefCursorSqlType.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.getRefCursorSqlType.

Get the java.sql.Types type for columns that return ResultSets as ref cursors if this feature is supported.

Annotations
@Override
getUserNameback to summary
public String getUserName()

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.getUserName.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.getUserName.

Get the name of the current user. Useful for meta-data lookups etc.

Returns:String

current user name from database connection

Annotations
@Override
identifierNameToUseback to summary
private String identifierNameToUse(String identifierName)
Annotations
@Nullable
initializeWithMetaDataback to summary
public void initializeWithMetaData(DatabaseMetaData databaseMetaData) throws SQLException

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.initializeWithMetaData.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.initializeWithMetaData.

Initialize using the provided DatabaseMetData.

Parameters
databaseMetaData:DatabaseMetaData

used to retrieve database specific information

Annotations
@Override
Exceptions
SQLException:
in case of initialization failure
initializeWithProcedureColumnMetaDataback to summary
public void initializeWithProcedureColumnMetaData(DatabaseMetaData databaseMetaData, String catalogName, String schemaName, String procedureName) throws SQLException

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.initializeWithProcedureColumnMetaData.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.initializeWithProcedureColumnMetaData.

Initialize the database specific management of procedure column meta-data.

This is only called for databases that are supported. This initialization can be turned off by specifying that column meta-data should not be used.

Parameters
databaseMetaData:DatabaseMetaData

used to retrieve database specific information

catalogName:String

name of catalog to use (or null if none)

schemaName:String

name of schema name to use (or null if none)

procedureName:String

name of the stored procedure

Annotations
@Override
Exceptions
SQLException:
in case of initialization failure
isInOrOutColumnback to summary
private static boolean isInOrOutColumn(int columnType, boolean function)
isProcedureColumnMetaDataUsedback to summary
public boolean isProcedureColumnMetaDataUsed()

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.isProcedureColumnMetaDataUsed.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.isProcedureColumnMetaDataUsed.

Are we using the meta-data for the procedure columns?

Annotations
@Override
isRefCursorSupportedback to summary
public boolean isRefCursorSupported()

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.isRefCursorSupported.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.isRefCursorSupported.

Does this database support returning ResultSets as ref cursors to be retrieved with java.sql.CallableStatement#getObject(int) for the specified column?

Annotations
@Override
isReturnResultSetSupportedback to summary
public boolean isReturnResultSetSupported()

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.isReturnResultSetSupported.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.isReturnResultSetSupported.

Does this database support returning ResultSets that should be retrieved with the JDBC call: java.sql.Statement#getResultSet()?

Annotations
@Override
isStoresLowerCaseIdentifiersback to summary
protected boolean isStoresLowerCaseIdentifiers()

Does the database use lower case for identifiers?

isStoresUpperCaseIdentifiersback to summary
protected boolean isStoresUpperCaseIdentifiers()

Does the database use upper case for identifiers?

isSupportsCatalogsInProcedureCallsback to summary
public boolean isSupportsCatalogsInProcedureCalls()

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.isSupportsCatalogsInProcedureCalls.

Does the database support the use of catalog name in procedure calls?

Annotations
@Override
isSupportsSchemasInProcedureCallsback to summary
public boolean isSupportsSchemasInProcedureCalls()

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.isSupportsSchemasInProcedureCalls.

Does the database support the use of schema name in procedure calls?

Annotations
@Override
metaDataCatalogNameToUseback to summary
public String metaDataCatalogNameToUse(String catalogName)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.metaDataCatalogNameToUse.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.metaDataCatalogNameToUse.

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.

Annotations
@Override
@Nullable
metaDataSchemaNameToUseback to summary
public String metaDataSchemaNameToUse(String schemaName)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.metaDataSchemaNameToUse.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.metaDataSchemaNameToUse.

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.

Annotations
@Override
@Nullable
namedParameterBindingToUseback to summary
public String namedParameterBindingToUse(String parameterName)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.namedParameterBindingToUse.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.namedParameterBindingToUse.

Return the name of the named parameter to use for binding the given parameter name.

Parameters
parameterName:String

the name of the parameter to bind

Returns:String

the name of the named parameter to use for binding the given parameter name

Annotations
@Override
parameterNameToUseback to summary
public String parameterNameToUse(String parameterName)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.parameterNameToUse.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.parameterNameToUse.

Provide any modification of the column name passed in to match the meta-data currently used.

This could include altering the case.

Parameters
parameterName:String

name of the parameter of column

Annotations
@Override
@Nullable
procedureNameToUseback to summary
public String procedureNameToUse(String procedureName)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.procedureNameToUse.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.procedureNameToUse.

Provide any modification of the procedure name passed in to match the meta-data currently used.

This could include altering the case.

Annotations
@Override
@Nullable
processProcedureColumnsback to summary
private void processProcedureColumns(DatabaseMetaData databaseMetaData, String catalogName, String schemaName, String procedureName)

Process the procedure column meta-data.

schemaNameToUseback to summary
public String schemaNameToUse(String schemaName)

Implements org.springframework.jdbc.core.metadata.CallMetaDataProvider.schemaNameToUse.

Doc from org.springframework.jdbc.core.metadata.CallMetaDataProvider.schemaNameToUse.

Provide any modification of the schema name passed in to match the meta-data currently used.

This could include altering the case.

Annotations
@Override
@Nullable
setStoresLowerCaseIdentifiersback to summary
protected void setStoresLowerCaseIdentifiers(boolean storesLowerCaseIdentifiers)

Specify whether the database uses lower case for identifiers.

setStoresUpperCaseIdentifiersback to summary
protected void setStoresUpperCaseIdentifiers(boolean storesUpperCaseIdentifiers)

Specify whether the database uses upper case for identifiers.

setSupportsCatalogsInProcedureCallsback to summary
protected void setSupportsCatalogsInProcedureCalls(boolean supportsCatalogsInProcedureCalls)

Specify whether the database supports the use of catalog name in procedure calls.

setSupportsSchemasInProcedureCallsback to summary
protected void setSupportsSchemasInProcedureCalls(boolean supportsSchemasInProcedureCalls)

Specify whether the database supports the use of schema name in procedure calls.