java.lang.Object | ||
↳ | org.springframework.jdbc.core.simple.AbstractJdbcCall | |
↳ | org.springframework.jdbc.core.simple.SimpleJdbcCall |
A SimpleJdbcCall is a multi-threaded, reusable object representing a call to a stored procedure or a stored function. It provides meta data processing to simplify the code needed to access basic stored procedures/functions. All you need to provide is the name of the procedure/function and a Map containing the parameters when you execute the call. The names of the supplied parameters will be matched up with in and out parameters declared when the stored procedure was created.
The meta data processing is based on the DatabaseMetaData provided by the JDBC driver. Since we rely on the JDBC driver this "auto-detection" can only be used for databases that are known to provide accurate meta data. These currently include Derby, MySQL, Microsoft SQL Server, Oracle, DB2, Sybase and PostgreSQL. For any other databases you are required to declare all parameters explicitly. You can of course declare all parameters explicitly even if the database provides the necessary meta data. In that case your declared parameters will take precedence. You can also turn off any mete data processing if you want to use parameter names that do not match what is declared during the stored procedure compilation.
The actual insert is being handled using Spring's
JdbcTemplate
.
Many of the configuration methods return the current instance of the SimpleJdbcCall to provide the ability to string multiple ones together in a "fluid" interface style.
JdbcTemplate
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.jdbc.core.simple.AbstractJdbcCall
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructor that takes one parameter with the JDBC DataSource to use when creating the
JdbcTemplate.
| |||||||||||
Alternative Constructor that takes one parameter with the JdbcTemplate to be used.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Specify one or more parameters if desired.
| |||||||||||
Execute the stored procedure and return a map of output params, keyed by name as in parameter declarations.
| |||||||||||
Execute the stored procedure and return a map of output params, keyed by name as in parameter declarations..
| |||||||||||
Execute the stored procedure and return a map of output params, keyed by name as in parameter declarations..
| |||||||||||
Execute the stored function and return the results obtained as an Object of the specified return type.
| |||||||||||
Execute the stored function and return the results obtained as an Object of the specified return type.
| |||||||||||
Execute the stored function and return the results obtained as an Object of the specified return type.
| |||||||||||
Execute the stored procedure and return the single out parameter as an Object of the specified return type.
| |||||||||||
Execute the stored procedure and return the single out parameter as an Object of the specified return type.
| |||||||||||
Execute the stored procedure and return the single out parameter as an Object of the specified return type.
| |||||||||||
This method is deprecated.
in favor of
returningResultSet(String, org.springframework.jdbc.core.RowMapper)
| |||||||||||
Used to specify when a ResultSet is returned by the stored procedure and you want it mapped
by a RowMapper.
| |||||||||||
Not used yet
| |||||||||||
Optionally, specify the name of the catalog that contins the stored procedure.
| |||||||||||
Specify the procedure name to be used - this implies that we will be calling a stored function.
| |||||||||||
Specify the procedure name to be used - this implies that we will be calling a stored procedure.
| |||||||||||
Indicates the procedure's return value should be included in the results returned.
| |||||||||||
Optionally, specify the name of the schema that contins the stored procedure.
| |||||||||||
Turn off any processing of parameter meta data information obtained via JDBC.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.jdbc.core.simple.AbstractJdbcCall
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.jdbc.core.simple.SimpleJdbcCallOperations
|
Constructor that takes one parameter with the JDBC DataSource to use when creating the JdbcTemplate.
dataSource | the DataSource to use |
---|
Alternative Constructor that takes one parameter with the JdbcTemplate to be used.
jdbcTemplate | the JdbcTemplate to use |
---|
Specify one or more parameters if desired. These parameters will be supplemented with any
parameter information retrieved from the database meta data.
Note that 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
.
sqlParameters | the parameters to use |
---|
Execute the stored procedure and return a map of output params, keyed by name as in parameter declarations.
args | optional array containing the in parameter values to be used in the call. Parameter values must be provided in the same order as the parameters are defined for the stored procedure. |
---|
Execute the stored procedure and return a map of output params, keyed by name as in parameter declarations..
args | Map containing the parameter values to be used in the call. |
---|
Execute the stored procedure and return a map of output params, keyed by name as in parameter declarations..
parameterSource | SqlParameterSource containing the parameter values to be used in the call. |
---|
Execute the stored function and return the results obtained as an Object of the specified return type.
returnType | the type of the value to return |
---|---|
args | MapSqlParameterSource containing the parameter values to be used in the call. |
Execute the stored function and return the results obtained as an Object of the specified return type.
returnType | the type of the value to return |
---|---|
args | optional array containing the in parameter values to be used in the call. Parameter values must be provided in the same order as the parameters are defined for the stored procedure. |
Execute the stored function and return the results obtained as an Object of the specified return type.
returnType | the type of the value to return |
---|---|
args | Map containing the parameter values to be used in the call. |
Execute the stored procedure and return the single out parameter as an Object of the specified return type. In the case where there are multiple out parameters, the first one is returned and additional out parameters are ignored.
returnType | the type of the value to return |
---|---|
args | optional array containing the in parameter values to be used in the call. Parameter values must be provided in the same order as the parameters are defined for the stored procedure. |
Execute the stored procedure and return the single out parameter as an Object of the specified return type. In the case where there are multiple out parameters, the first one is returned and additional out parameters are ignored.
returnType | the type of the value to return |
---|---|
args | MapSqlParameterSource containing the parameter values to be used in the call. |
Execute the stored procedure and return the single out parameter as an Object of the specified return type. In the case where there are multiple out parameters, the first one is returned and additional out parameters are ignored.
returnType | the type of the value to return |
---|---|
args | Map containing the parameter values to be used in the call. |
This method is deprecated.
in favor of returningResultSet(String, org.springframework.jdbc.core.RowMapper)
Used to specify when a ResultSet is returned by the stored procedure and you want it mapped by a RowMapper. The results will be returned using the parameter name specified. Multiple ResultSets must be declared in the correct order. If the database you are using uses ref cursors then the name specified must match the name of the parameter declared for the procedure in the database.
Used to specify when a ResultSet is returned by the stored procedure and you want it mapped by a RowMapper. The results will be returned using the parameter name specified. Multiple ResultSets must be declared in the correct order. If the database you are using uses ref cursors then the name specified must match the name of the parameter declared for the procedure in the database.
parameterName | the name of the returned results and/or the name of the ref cursor parameter |
---|---|
rowMapper | the RowMapper implementation that will map the data returned for each row |
Optionally, specify the name of the catalog that contins the stored procedure. To provide consistency with the Oracle DatabaseMetaData, this is used to specify the package name if the procedure is declared as part of a package.
catalogName | the catalog or package name |
---|
Specify the procedure name to be used - this implies that we will be calling a stored function.
functionName | the name of the stored function |
---|
Specify the procedure name to be used - this implies that we will be calling a stored procedure.
procedureName | the name of the stored procedure |
---|
Indicates the procedure's return value should be included in the results returned.
Optionally, specify the name of the schema that contins the stored procedure.
schemaName | the name of the schema |
---|
Turn off any processing of parameter meta data information obtained via JDBC.