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()
Method to perform the actual compilation.
|
protected Map<String,Object> |
doExecute(Map<String,?> args)
Method that provides execution of the call using the passed in Map of parameters
|
protected Map<String,Object> |
doExecute(Object[] args)
Method that provides execution of the call using the passed in array of parameters
|
protected Map<String,Object> |
doExecute(SqlParameterSource parameterSource)
Method that provides execution of 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 |
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 |
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 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
.protected CallableStatementCreatorFactory getCallableStatementFactory()
CallableStatementCreatorFactory
being usedpublic 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)
public boolean isFunction()
public void setReturnValueRequired(boolean b)
public boolean isReturnValueRequired()
public void addDeclaredParameter(SqlParameter parameter)
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 String getCallString()
public void setAccessCallParameterMetaData(boolean accessCallParameterMetaData)
public final void compile() throws InvalidDataAccessApiUsageException
InvalidDataAccessApiUsageException
- if the object hasn't
been correctly initialized, for example if no DataSource has been providedprotected void compileInternal()
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; order must match the order declared for the stored procedureprotected Map<String,Object> doExecute(Map<String,?> args)
args
- Map of parameter name and valuesprotected String getScalarOutParameterName()
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 Mapprotected List<SqlParameter> getCallParameters()