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 meta-data processing if you want to use parameter names that do not match what is declared during the stored procedure compilation.
The actual call is being handled using Spring's JdbcTemplate.
Many of the configuration methods return the current instance of the SimpleJdbcCall in order to provide the ability to chain multiple ones together in a "fluent" interface style.
java.sql.DatabaseMetaData , org.springframework.jdbc.core.JdbcTemplate
| Access | Constructor and Description |
|---|---|
| public | SimpleJdbcCall(DataSource
the dataSource)DataSource to useConstructor that takes one parameter with the JDBC DataSource to use when creating the underlying JdbcTemplate. |
| public | SimpleJdbcCall(JdbcTemplate
the jdbcTemplate)JdbcTemplate to useAlternative Constructor that takes one parameter with the JdbcTemplate to be used. |
| Modifier and Type | Method and Description |
|---|---|
| public SimpleJdbcCall | declareParameters(SqlParameter...
the parameters to use sqlParameters)Implements org. Specify one or more parameters if desired. |
| public Map | execute(Object...
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. args)Implements org. Execute the stored procedure and return a map of output params, keyed by name as in parameter declarations. |
| public Map | execute(Map<String, ?>
a Map containing the parameter values to be used in the call args)Implements org. Execute the stored procedure and return a map of output params, keyed by name as in parameter declarations. |
| public Map | execute(SqlParameterSource
the SqlParameterSource containing the parameter values to be used in the call parameterSource)Implements org. Execute the stored procedure and return a map of output params, keyed by name as in parameter declarations. |
| public <T> T | executeFunction(Class<T>
the type of the value to return returnType, Object... 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. args)Implements org. Execute the stored function and return the results obtained as an Object of the specified return type. |
| public <T> T | executeFunction(Class<T>
the type of the value to return returnType, Map<String, ?> a Map containing the parameter values to be used in the call args)Implements org. Execute the stored function and return the results obtained as an Object of the specified return type. |
| public <T> T | executeFunction(Class<T>
the type of the value to return returnType, SqlParameterSource the MapSqlParameterSource containing the parameter values to be used in the call args)Implements org. Execute the stored function and return the results obtained as an Object of the specified return type. |
| public <T> T | executeObject(Class<T>
the type of the value to return returnType, Object... 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. args)Implements org. Execute the stored procedure and return the single out parameter as an Object of the specified return type. |
| public <T> T | executeObject(Class<T>
the type of the value to return returnType, Map<String, ?> a Map containing the parameter values to be used in the call args)Implements org. Execute the stored procedure and return the single out parameter as an Object of the specified return type. |
| public <T> T | executeObject(Class<T>
the type of the value to return returnType, SqlParameterSource the MapSqlParameterSource containing the parameter values to be used in the call args)Implements org. Execute the stored procedure and return the single out parameter as an Object of the specified return type. |
| public SimpleJdbcCall | returningResultSet(String
the name of the returned results and/or the name of the ref cursor parameter parameterName, RowMapper<?> the RowMapper implementation that will map the data returned for each row rowMapper)Implements org. Used to specify when a ResultSet is returned by the stored procedure and you want it
mapped by a |
| public SimpleJdbcCall | useInParameterNames(String... inParameterNames)
Implements org. Not used yet. |
| public SimpleJdbcCall | withCatalogName(String
the catalog or package name catalogName)Implements org. Optionally, specify the name of the catalog that contins the stored procedure. |
| public SimpleJdbcCall | withFunctionName(String
the name of the stored function functionName)Implements org. Specify the procedure name to be used - this implies that we will be calling a stored function. |
| public SimpleJdbcCall | withNamedBinding()
Implements org. Indicates that parameters should be bound by name. |
| public SimpleJdbcCall | withoutProcedureColumnMetaDataAccess()
Implements org. Turn off any processing of parameter meta-data information obtained via JDBC. |
| public SimpleJdbcCall | withProcedureName(String
the name of the stored procedure procedureName)Implements org. Specify the procedure name to be used - this implies that we will be calling a stored procedure. |
| public SimpleJdbcCall | withReturnValue()
Implements org. Indicates the procedure's return value should be included in the results returned. |
| public SimpleJdbcCall | withSchemaName(String
the name of the schema schemaName)Implements org. Optionally, specify the name of the schema that contins the stored procedure. |
| SimpleJdbcCall | back to summary |
|---|---|
| public SimpleJdbcCall(DataSource dataSource) Constructor that takes one parameter with the JDBC DataSource to use when creating the underlying JdbcTemplate.
| |
| SimpleJdbcCall | back to summary |
|---|---|
| public SimpleJdbcCall(JdbcTemplate jdbcTemplate) Alternative Constructor that takes one parameter with the JdbcTemplate to be used.
| |
| declareParameters | back to summary |
|---|---|
| public SimpleJdbcCall declareParameters(SqlParameter... sqlParameters) Implements org. Doc from org. 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
| |
| execute | back to summary |
|---|---|
| public Map Implements org. Doc from org. Execute the stored procedure and return a map of output params, keyed by name as in parameter declarations. | |
| execute | back to summary |
|---|---|
| public Map Implements org. Doc from org. Execute the stored procedure and return a map of output params, keyed by name as in parameter declarations. | |
| execute | back to summary |
|---|---|
| public Map Implements org. Doc from org. Execute the stored procedure and return a map of output params, keyed by name as in parameter declarations.
| |
| executeFunction | back to summary |
|---|---|
| public <T> T executeFunction(Class<T> returnType, Object... args) Implements org. Doc from org. Execute the stored function and return the results obtained as an Object of the specified return type.
| |
| executeFunction | back to summary |
|---|---|
| public <T> T executeFunction(Class<T> returnType, Map<String, ?> args) Implements org. Doc from org. Execute the stored function and return the results obtained as an Object of the specified return type.
| |
| executeFunction | back to summary |
|---|---|
| public <T> T executeFunction(Class<T> returnType, SqlParameterSource args) Implements org. Doc from org. Execute the stored function and return the results obtained as an Object of the specified return type.
| |
| executeObject | back to summary |
|---|---|
| public <T> T executeObject(Class<T> returnType, Object... args) Implements org. Doc from org. 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.
| |
| executeObject | back to summary |
|---|---|
| public <T> T executeObject(Class<T> returnType, Map<String, ?> args) Implements org. Doc from org. 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.
| |
| executeObject | back to summary |
|---|---|
| public <T> T executeObject(Class<T> returnType, SqlParameterSource args) Implements org. Doc from org. 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.
| |
| returningResultSet | back to summary |
|---|---|
| public SimpleJdbcCall returningResultSet(String parameterName, RowMapper<?> rowMapper) Implements org. Doc from org. Used to specify when a ResultSet is returned by the stored procedure and you want it
mapped by a 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. | |
| useInParameterNames | back to summary |
|---|---|
| public SimpleJdbcCall useInParameterNames(String... inParameterNames) Implements org. Doc from org. Not used yet.
| |
| withCatalogName | back to summary |
|---|---|
| public SimpleJdbcCall withCatalogName(String catalogName) Implements org. Doc from org. 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.
| |
| withFunctionName | back to summary |
|---|---|
| public SimpleJdbcCall withFunctionName(String functionName) Implements org. Doc from org. Specify the procedure name to be used - this implies that we will be calling a stored function.
| |
| withNamedBinding | back to summary |
|---|---|
| public SimpleJdbcCall withNamedBinding() Implements org. Doc from org. Indicates that parameters should be bound by name.
| |
| withoutProcedureColumnMetaDataAccess | back to summary |
|---|---|
| public SimpleJdbcCall withoutProcedureColumnMetaDataAccess() Implements org. Doc from org. Turn off any processing of parameter meta-data information obtained via JDBC.
| |
| withProcedureName | back to summary |
|---|---|
| public SimpleJdbcCall withProcedureName(String procedureName) Implements org. Doc from org. Specify the procedure name to be used - this implies that we will be calling a stored procedure.
| |
| withReturnValue | back to summary |
|---|---|
| public SimpleJdbcCall withReturnValue() Implements org. Doc from org. Indicates the procedure's return value should be included in the results returned.
| |
| withSchemaName | back to summary |
|---|---|
| public SimpleJdbcCall withSchemaName(String schemaName) Implements org. Doc from org. Optionally, specify the name of the schema that contins the stored procedure.
| |