public abstract class

AbstractJdbcCall

extends Object
java.lang.Object
   ↳ org.springframework.jdbc.core.simple.AbstractJdbcCall
Known Direct Subclasses

Class Overview

Abstract class to provide base functionality for easy stored procedure calls based on configuration options and database metadata. This class provides the base SPI for SimpleJdbcCall.

Summary

Fields
protected final Log logger Logger available to subclasses
Protected Constructors
AbstractJdbcCall(DataSource dataSource)
Constructor to be used when initializing using a DataSource.
AbstractJdbcCall(JdbcTemplate jdbcTemplate)
Constructor to be used when initializing using a JdbcTemplate.
Public Methods
void addDeclaredParameter(SqlParameter parameter)
Add a declared parameter to the list of parameters for the call.
void addDeclaredRowMapper(String parameterName, ParameterizedRowMapper rowMapper)
void addDeclaredRowMapper(String parameterName, RowMapper rowMapper)
Add a RowMapper for the specified parameter or column.
synchronized final void compile()
Compile this JdbcCall using provided parameters and meta data plus other settings.
String getCallString()
Get the call string that should be used based on parameters and meta data
String getCatalogName()
Get the catalog name used.
Set<String> getInParameterNames()
Get the names of in parameters to be used.
JdbcTemplate getJdbcTemplate()
Get the configured JdbcTemplate
String getProcedureName()
Get the name of the stored procedure.
String getSchemaName()
Get the schema name used.
boolean isCompiled()
Is this operation "compiled"?
boolean isFunction()
Is this call a function call?
boolean isReturnValueRequired()
Does the call require a return value?
void setAccessCallParameterMetaData(boolean accessCallParameterMetaData)
Specify whether the parameter metadata for the call should be used.
void setCatalogName(String catalogName)
Set the catalog name to use.
void setFunction(boolean function)
Specify whether this call is a function call.
void setInParameterNames(Set<String> inParameterNames)
Set the names of in parameters to be used.
void setProcedureName(String procedureName)
Set the name of the stored procedure.
void setReturnValueRequired(boolean b)
Specify whether the call requires a rerurn value.
void setSchemaName(String schemaName)
Set the schema name to use,
Protected Methods
void checkCompiled()
Check whether this operation has been compiled already; lazily compile it if not already compiled.
void compileInternal()
Method to perform the actual compilation.
Map<StringObject> doExecute(SqlParameterSource parameterSource)
Method that provides execution of the call using the passed in SqlParameterSource
Map<StringObject> doExecute(Object[] args)
Method that provides execution of the call using the passed in array of parameters
Map<StringObject> doExecute(Map<String, ?> args)
Method that provides execution of the call using the passed in Map of parameters
List<SqlParameter> getCallParameters()
Get a List of all the call parameters to be used for call.
CallableStatementCreatorFactory getCallableStatementFactory()
String getScalarOutParameterName()
Get the name of a single out parameter or return value.
Map<String, ?> matchInParameterValuesWithCallParameters(Map<String, ?> args)
Match the provided in parameter values with registered parameters and parameters defined via metadata processing.
Map<StringObject> matchInParameterValuesWithCallParameters(SqlParameterSource parameterSource)
Match the provided in parameter values with registered parameters and parameters defined via metadata processing.
void onCompileInternal()
Hook method that subclasses may override to react to compilation.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected final Log logger

Logger available to subclasses

Protected Constructors

protected AbstractJdbcCall (DataSource dataSource)

Constructor to be used when initializing using a DataSource.

Parameters
dataSource the DataSource to be used

protected AbstractJdbcCall (JdbcTemplate jdbcTemplate)

Constructor to be used when initializing using a JdbcTemplate.

Parameters
jdbcTemplate the JdbcTemplate to use

Public Methods

public void addDeclaredParameter (SqlParameter parameter)

Add a declared parameter to the list of parameters for the call. Only parameters declared as SqlParameter and SqlInOutParameter will be used to provide input values. This is different from the StoredProcedure class which for backwards compatibility reasons allows input values to be provided for parameters declared as SqlOutParameter.

Parameters
parameter the SqlParameter to add

public void addDeclaredRowMapper (String parameterName, ParameterizedRowMapper rowMapper)

This method is deprecated.
in favor of addDeclaredRowMapper(String, org.springframework.jdbc.core.RowMapper)

Add a RowMapper for the specified parameter or column.

public void addDeclaredRowMapper (String parameterName, RowMapper rowMapper)

Add a RowMapper for the specified parameter or column.

Parameters
parameterName name of parameter or column
rowMapper the RowMapper implementation to use

public final synchronized void compile ()

Compile this JdbcCall using provided parameters and meta data plus other settings. This finalizes the configuration for this object and subsequent attempts to compile are ignored. This will be implicitly called the first time an un-compiled call is executed.

Throws
InvalidDataAccessApiUsageException if the object hasn't been correctly initialized, for example if no DataSource has been provided

public String getCallString ()

Get the call string that should be used based on parameters and meta data

public String getCatalogName ()

Get the catalog name used.

public Set<String> getInParameterNames ()

Get the names of in parameters to be used.

public JdbcTemplate getJdbcTemplate ()

Get the configured JdbcTemplate

public String getProcedureName ()

Get the name of the stored procedure.

public String getSchemaName ()

Get the schema name used.

public boolean isCompiled ()

Is this operation "compiled"?

Returns
  • whether this operation is compiled, and ready to use.

public boolean isFunction ()

Is this call a function call?

public boolean isReturnValueRequired ()

Does the call require a return value?

public void setAccessCallParameterMetaData (boolean accessCallParameterMetaData)

Specify whether the parameter metadata for the call should be used. The default is true.

public void setCatalogName (String catalogName)

Set the catalog name to use.

public void setFunction (boolean function)

Specify whether this call is a function call.

public void setInParameterNames (Set<String> inParameterNames)

Set the names of in parameters to be used.

public void setProcedureName (String procedureName)

Set the name of the stored procedure.

public void setReturnValueRequired (boolean b)

Specify whether the call requires a rerurn value.

public void setSchemaName (String schemaName)

Set the schema name to use,

Protected Methods

protected void checkCompiled ()

Check whether this operation has been compiled already; lazily compile it if not already compiled.

Automatically called by doExecute.

protected void compileInternal ()

Method to perform the actual compilation. Subclasses can override this template method to perform their own compilation. Invoked after this base class's compilation is complete.

protected Map<StringObject> doExecute (SqlParameterSource parameterSource)

Method that provides execution of the call using the passed in SqlParameterSource

Parameters
parameterSource parameter names and values to be used in call
Returns
  • Map of out parameters

protected Map<StringObject> doExecute (Object[] args)

Method that provides execution of the call using the passed in array of parameters

Parameters
args array of parameter values; order must match the order declared for the stored procedure
Returns
  • Map of out parameters

protected Map<StringObject> doExecute (Map<String, ?> args)

Method that provides execution of the call using the passed in Map of parameters

Parameters
args Map of parameter name and values
Returns
  • Map of out parameters

protected List<SqlParameter> getCallParameters ()

Get a List of all the call parameters to be used for call. This includes any parameters added based on meta data processing.

protected CallableStatementCreatorFactory getCallableStatementFactory ()

protected String getScalarOutParameterName ()

Get the name of a single out parameter or return value. Used for functions or procedures with one out parameter.

protected Map<String, ?> matchInParameterValuesWithCallParameters (Map<String, ?> args)

Match the provided in parameter values with registered parameters and parameters defined via metadata processing.

Parameters
args the parameter values provided in a Map
Returns
  • Map with parameter names and values

protected Map<StringObject> matchInParameterValuesWithCallParameters (SqlParameterSource parameterSource)

Match the provided in parameter values with registered parameters and parameters defined via metadata processing.

Parameters
parameterSource the parameter vakues provided as a SqlParameterSource
Returns
  • Map with parameter names and values

protected void onCompileInternal ()

Hook method that subclasses may override to react to compilation. This implementation does nothing.