类 StoredProcedure
- java.lang.Object
- org.springframework.jdbc.object.RdbmsOperation
- org.springframework.jdbc.object.SqlCall
- org.springframework.jdbc.object.StoredProcedure
- 所有已实现的接口:
InitializingBean
- 直接已知子类:
GenericStoredProcedure
public abstract class StoredProcedure extends SqlCall
Superclass for object abstractions of RDBMS stored procedures. This class is abstract and it is intended that subclasses will provide a typed method for invocation that delegates to the suppliedexecute(java.lang.Object...)
method.The inherited
sql
property is the name of the stored procedure in the RDBMS.- 作者:
- Rod Johnson, Thomas Risberg
- 另请参阅:
RdbmsOperation.setSql(java.lang.String)
字段概要
从类继承的字段 org.springframework.jdbc.object.RdbmsOperation
logger
构造器概要
构造器 限定符 构造器 说明 protected
StoredProcedure()
Allow use as a bean.protected
StoredProcedure(DataSource ds, String name)
Create a new object wrapper for a stored procedure.protected
StoredProcedure(JdbcTemplate jdbcTemplate, String name)
Create a new object wrapper for a stored procedure.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected boolean
allowsUnusedParameters()
StoredProcedure parameter Maps are by default allowed to contain additional entries that are not actually used as parameters.void
declareParameter(SqlParameter param)
Declare a parameter.Map<String,Object>
execute(Object... inParams)
Execute the stored procedure with the provided parameter values.Map<String,Object>
execute(Map<String,?> inParams)
Execute the stored procedure.Map<String,Object>
execute(ParameterMapper inParamMapper)
Execute the stored procedure.从类继承的方法 org.springframework.jdbc.object.SqlCall
compileInternal, getCallString, isFunction, isSqlReadyForUse, newCallableStatementCreator, newCallableStatementCreator, onCompileInternal, setFunction, setSqlReadyForUse
从类继承的方法 org.springframework.jdbc.object.RdbmsOperation
afterPropertiesSet, checkCompiled, compile, getDeclaredParameters, getGeneratedKeysColumnNames, getJdbcTemplate, getResultSetType, getSql, isCompiled, isReturnGeneratedKeys, isUpdatableResults, setDataSource, setFetchSize, setGeneratedKeysColumnNames, setJdbcTemplate, setMaxRows, setParameters, setQueryTimeout, setResultSetType, setReturnGeneratedKeys, setSql, setTypes, setUpdatableResults, supportsLobParameters, validateNamedParameters, validateParameters
构造器详细资料
StoredProcedure
protected StoredProcedure()
Allow use as a bean.
StoredProcedure
protected StoredProcedure(DataSource ds, String name)
Create a new object wrapper for a stored procedure.- 参数:
ds
- DataSource to use throughout the lifetime of this object to obtain connectionsname
- name of the stored procedure in the database
StoredProcedure
protected StoredProcedure(JdbcTemplate jdbcTemplate, String name)
Create a new object wrapper for a stored procedure.- 参数:
jdbcTemplate
- JdbcTemplate which wraps DataSourcename
- name of the stored procedure in the database
方法详细资料
allowsUnusedParameters
protected boolean allowsUnusedParameters()
StoredProcedure parameter Maps are by default allowed to contain additional entries that are not actually used as parameters.- 覆盖:
allowsUnusedParameters
在类中RdbmsOperation
- 另请参阅:
StoredProcedure
declareParameter
public void declareParameter(SqlParameter param) throws InvalidDataAccessApiUsageException
Declare a parameter. Overridden method. Parameters declared asSqlParameter
andSqlInOutParameter
will always be used to provide input values. In addition to this any parameter declared asSqlOutParameter
where an non-null input value is provided will also be used as an input paraneter. Note: Calls to declareParameter must be made in the same order as they appear in the database's stored procedure parameter list. Names are purely used to help mapping.- 覆盖:
declareParameter
在类中RdbmsOperation
- 参数:
param
- parameter object- 抛出:
InvalidDataAccessApiUsageException
- if the operation is already compiled, and hence cannot be configured further
execute
public Map<String,Object> execute(Object... inParams)
Execute the stored procedure with the provided parameter values. This is a convenience method where the order of the passed in parameter values must match the order that the parameters where declared in.- 参数:
inParams
- variable number of input parameters. Output parameters should not be included in this map. It is legal for values to benull
, and this will produce the correct behavior using a NULL argument to the stored procedure.- 返回:
- map of output params, keyed by name as in parameter declarations. Output parameters will appear here, with their values after the stored procedure has been called.
execute
public Map<String,Object> execute(Map<String,?> inParams) throws DataAccessException
Execute the stored procedure. Subclasses should define a strongly typed execute method (with a meaningful name) that invokes this method, populating the input map and extracting typed values from the output map. Subclass execute methods will often take domain objects as arguments and return values. Alternatively, they can return void.- 参数:
inParams
- map of input parameters, keyed by name as in parameter declarations. Output parameters need not (but can) be included in this map. It is legal for map entries to benull
, and this will produce the correct behavior using a NULL argument to the stored procedure.- 返回:
- map of output params, keyed by name as in parameter declarations. Output parameters will appear here, with their values after the stored procedure has been called.
- 抛出:
DataAccessException
execute
public Map<String,Object> execute(ParameterMapper inParamMapper) throws DataAccessException
Execute the stored procedure. Subclasses should define a strongly typed execute method (with a meaningful name) that invokes this method, passing in a ParameterMapper that will populate the input map. This allows mapping database specific features since the ParameterMapper has access to the Connection object. The execute method is also responsible for extracting typed values from the output map. Subclass execute methods will often take domain objects as arguments and return values. Alternatively, they can return void.- 参数:
inParamMapper
- map of input parameters, keyed by name as in parameter declarations. Output parameters need not (but can) be included in this map. It is legal for map entries to benull
, and this will produce the correct behavior using a NULL argument to the stored procedure.- 返回:
- map of output params, keyed by name as in parameter declarations. Output parameters will appear here, with their values after the stored procedure has been called.
- 抛出:
DataAccessException