|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.jdbc.core.simple.AbstractJdbcCall
public abstract class AbstractJdbcCall
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
.
Field Summary | |
---|---|
protected Log |
logger
Logger available to subclasses |
Constructor Summary | |
---|---|
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 . |
Method Summary | |
---|---|
void |
addDeclaredParameter(SqlParameter parameter)
Add a declared parameter to the list of parameters for the call. |
void |
addDeclaredRowMapper(String parameterName,
ParameterizedRowMapper rowMapper)
Deprecated. in favor of addDeclaredRowMapper(String, org.springframework.jdbc.core.RowMapper) |
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, |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Log logger
Constructor Detail |
---|
protected AbstractJdbcCall(DataSource dataSource)
DataSource
.
dataSource
- the DataSource to be usedprotected AbstractJdbcCall(JdbcTemplate jdbcTemplate)
JdbcTemplate
.
jdbcTemplate
- the JdbcTemplate to useMethod Detail |
---|
public JdbcTemplate getJdbcTemplate()
JdbcTemplate
protected CallableStatementCreatorFactory getCallableStatementFactory()
CallableStatementCreatorFactory
being used
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)
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 use@Deprecated public void addDeclaredRowMapper(String parameterName, ParameterizedRowMapper rowMapper)
addDeclaredRowMapper(String, org.springframework.jdbc.core.RowMapper)
RowMapper
for the specified parameter or column.
public 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 call
protected Map<String,Object> doExecute(Object[] args)
args
- array of parameter values; order must match the order declared for the stored procedure
protected Map<String,Object> doExecute(Map<String,?> args)
args
- Map of parameter name and values
protected 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 Map
protected List<SqlParameter> getCallParameters()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |