public abstract class AbstractJdbcCall extends Object
SimpleJdbcCall
.Modifier and Type | Field and Description |
---|---|
protected Log |
logger
Logger available to subclasses
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractJdbcCall(DataSource dataSource)
Constructor to be used when initializing using a
DataSource . |
protected |
AbstractJdbcCall(JdbcTemplate jdbcTemplate)
Constructor to be used when initializing using a
JdbcTemplate . |
Modifier and Type | Method and Description |
---|---|
void |
addDeclaredParameter(SqlParameter parameter)
Add a declared parameter to the list of parameters for the call.
|
void |
addDeclaredRowMapper(String parameterName,
RowMapper<?> rowMapper)
Add a
RowMapper for the specified parameter or column. |
protected void |
checkCompiled()
Check whether this operation has been compiled already;
lazily compile it if not already compiled.
|
void |
compile()
Compile this JdbcCall using provided parameters and meta data plus other settings.
|
protected void |
compileInternal()
Delegate method to perform the actual compilation.
|
protected Map<String,Object> |
doExecute(Map<String,?> args)
Delegate method that executes the call using the passed-in Map of parameters.
|
protected Map<String,Object> |
doExecute(Object... args)
Delegate method that executes the call using the passed-in array of parameters.
|
protected Map<String,Object> |
doExecute(SqlParameterSource parameterSource)
Delegate method that executes the call using the passed-in
SqlParameterSource . |
protected CallableStatementCreatorFactory |
getCallableStatementFactory()
Get the
CallableStatementCreatorFactory being used |
protected List<SqlParameter> |
getCallParameters()
Get a List of all the call parameters to be used for call.
|
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.
|
protected String |
getScalarOutParameterName()
Get the name of a single out parameter or return value.
|
String |
getSchemaName()
Get the schema name used.
|
boolean |
isCompiled()
Is this operation "compiled"?
|
boolean |
isFunction()
Is this call a function call?
|
boolean |
isNamedBinding()
Does parameters should be bound by name?
|
boolean |
isReturnValueRequired()
Does the call require a return value?
|
protected Map<String,?> |
matchInParameterValuesWithCallParameters(Map<String,?> args)
Match the provided in parameter values with registered parameters and
parameters defined via metadata processing.
|
protected Map<String,Object> |
matchInParameterValuesWithCallParameters(SqlParameterSource parameterSource)
Match the provided in parameter values with registered parameters and
parameters defined via metadata processing.
|
protected void |
onCompileInternal()
Hook method that subclasses may override to react to compilation.
|
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 |
setNamedBinding(boolean namedBinding)
Specify whether parameters should be bound by name.
|
void |
setProcedureName(String procedureName)
Set the name of the stored procedure.
|
void |
setReturnValueRequired(boolean returnValueRequired)
Specify whether the call requires a return value.
|
void |
setSchemaName(String schemaName)
Set the schema name to use.
|
protected final Log logger
protected AbstractJdbcCall(DataSource dataSource)
DataSource
.dataSource
- the DataSource to be usedprotected AbstractJdbcCall(JdbcTemplate jdbcTemplate)
JdbcTemplate
.jdbcTemplate
- the JdbcTemplate to usepublic JdbcTemplate getJdbcTemplate()
JdbcTemplate
.public void setProcedureName(String procedureName)
public String getProcedureName()
public void setInParameterNames(Set<String> inParameterNames)
public Set<String> getInParameterNames()
public void setCatalogName(String catalogName)
public String getCatalogName()
public void setSchemaName(String schemaName)
public String getSchemaName()
public void setFunction(boolean function)
false
.public boolean isFunction()
public void setReturnValueRequired(boolean returnValueRequired)
false
.public boolean isReturnValueRequired()
public void setAccessCallParameterMetaData(boolean accessCallParameterMetaData)
true
.public boolean isNamedBinding()
public void setNamedBinding(boolean namedBinding)
false
.public String getCallString()
protected CallableStatementCreatorFactory getCallableStatementFactory()
CallableStatementCreatorFactory
being usedpublic void addDeclaredParameter(SqlParameter parameter)
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
.
parameter
- the SqlParameter
to addpublic void addDeclaredRowMapper(String parameterName, RowMapper<?> rowMapper)
RowMapper
for the specified parameter or column.parameterName
- name of parameter or columnrowMapper
- the RowMapper implementation to usepublic final void compile() throws InvalidDataAccessApiUsageException
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.
InvalidDataAccessApiUsageException
- if the object hasn't
been correctly initialized, for example if no DataSource has been providedprotected void compileInternal()
Subclasses can override this template method to perform their own compilation. Invoked after this base class's compilation is complete.
protected void onCompileInternal()
public boolean isCompiled()
protected void checkCompiled()
Automatically called by doExecute
.
protected Map<String,Object> doExecute(SqlParameterSource parameterSource)
SqlParameterSource
.parameterSource
- parameter names and values to be used in callprotected Map<String,Object> doExecute(Object... args)
args
- array of parameter values. The order of values must match the order
declared for the stored procedure.protected Map<String,Object> doExecute(Map<String,?> args)
args
- Map of parameter name and valuesprotected String getScalarOutParameterName()
protected List<SqlParameter> getCallParameters()
protected Map<String,Object> matchInParameterValuesWithCallParameters(SqlParameterSource parameterSource)
parameterSource
- the parameter vakues provided as a SqlParameterSource
protected Map<String,?> matchInParameterValuesWithCallParameters(Map<String,?> args)
args
- the parameter values provided in a Map