java.lang.Object | |
↳ | org.springframework.jdbc.object.RdbmsOperation |
Known Direct Subclasses |
Known Indirect Subclasses |
An "RDBMS operation" is a multi-threaded, reusable object representing a query, update, or stored procedure call. An RDBMS operation is not a command, as a command is not reusable. However, execute methods may take commands as arguments. Subclasses should be JavaBeans, allowing easy configuration.
This class and subclasses throw runtime exceptions, defined in the
Subclasses should set SQL and add parameters before invoking the
org.springframework.jdbc.core
package, which the classes
in this package use under the hood to perform raw JDBC operations).
compile()
method. The order in which parameters are added is
significant. The appropriate execute
or update
method can then be invoked.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
logger | Logger available to subclasses |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Ensures compilation if used in a bean factory.
| |||||||||||
Compile this query.
| |||||||||||
Declare a parameter for this operation.
| |||||||||||
Return the column names of the auto generated keys.
| |||||||||||
Return the JdbcTemplate object used by this object.
| |||||||||||
Return whether statements will return a specific type of ResultSet.
| |||||||||||
Subclasses can override this to supply dynamic SQL if they wish,
but SQL is normally set by calling the setSql() method
or in a subclass constructor.
| |||||||||||
Is this operation "compiled"? Compilation, as in JDO,
means that the operation is fully configured, and ready to use.
| |||||||||||
Return whether statements should be capable of returning
auto-generated keys.
| |||||||||||
Return whether statements will return updatable ResultSets.
| |||||||||||
Set the JDBC DataSource to obtain connections from.
| |||||||||||
Set the fetch size for this RDBMS operation.
| |||||||||||
Set the column names of the auto-generated keys.
| |||||||||||
An alternative to the more commonly used setDataSource() when you want to
use the same JdbcTemplate in multiple RdbmsOperations.
| |||||||||||
Set the maximum number of rows for this RDBMS operation.
| |||||||||||
Add one or more declared parameters.
| |||||||||||
Set the query timeout for statements that this RDBMS operation executes.
| |||||||||||
Set whether to use statements that return a specific type of ResultSet.
| |||||||||||
Set whether prepared statements should be capable of returning
auto-generated keys.
| |||||||||||
Set the SQL executed by this operation.
| |||||||||||
Add anonymous parameters, specifying only their SQL types
as defined in the
java.sql.Types class. | |||||||||||
Set whether to use statements that are capable of returning
updatable ResultSets.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return whether this operation accepts additional parameters that are
given but not actually used.
| |||||||||||
Check whether this operation has been compiled already;
lazily compile it if not already compiled.
| |||||||||||
Subclasses must implement this template method to perform their own compilation.
| |||||||||||
Return a list of the declared
SqlParameter objects. | |||||||||||
Return whether BLOB/CLOB parameters are supported for this kind of operation.
| |||||||||||
Validate the named parameters passed to an execute method based on declared parameters.
| |||||||||||
Validate the parameters passed to an execute method based on declared parameters.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.beans.factory.InitializingBean
|
Logger available to subclasses
Ensures compilation if used in a bean factory.
Compile this query. Ignores subsequent attempts to compile.
InvalidDataAccessApiUsageException | if the object hasn't been correctly initialized, for example if no DataSource has been provided |
---|
Declare a parameter for this operation.
The order in which this method is called is significant when using positional parameters. It is not significant when using named parameters with named SqlParameter objects here; it remains significant when using named parameters in combination with unnamed SqlParameter objects here.
param | the SqlParameter to add. This will specify SQL type and (optionally)
the parameter's name. Note that you typically use the SqlParameter class
itself here, not any of its subclasses. |
---|
InvalidDataAccessApiUsageException | if the operation is already compiled, and hence cannot be configured further |
---|
Return whether statements will return a specific type of ResultSet.
Subclasses can override this to supply dynamic SQL if they wish, but SQL is normally set by calling the setSql() method or in a subclass constructor.
Is this operation "compiled"? Compilation, as in JDO, means that the operation is fully configured, and ready to use. The exact meaning of compilation will vary between subclasses.
Return whether statements should be capable of returning auto-generated keys.
Return whether statements will return updatable ResultSets.
Set the JDBC DataSource to obtain connections from.
Set the fetch size for this RDBMS operation. This is important for processing large result sets: Setting this higher than the default value will increase processing speed at the cost of memory consumption; setting this lower can avoid transferring row data that will never be read by the application.
Default is 0, indicating to use the driver's default.
Set the column names of the auto-generated keys.
An alternative to the more commonly used setDataSource() when you want to use the same JdbcTemplate in multiple RdbmsOperations. This is appropriate if the JdbcTemplate has special configuration such as a SQLExceptionTranslator that should apply to multiple RdbmsOperation objects.
Set the maximum number of rows for this RDBMS operation. This is important for processing subsets of large result sets, avoiding to read and hold the entire result set in the database or in the JDBC driver.
Default is 0, indicating to use the driver's default.
Add one or more declared parameters. Used for configuring this operation when used in a bean factory. Each parameter will specify SQL type and (optionally) the parameter's name.
parameters | Array containing the declared SqlParameter objects |
---|
Set the query timeout for statements that this RDBMS operation executes.
Default is 0, indicating to use the JDBC driver's default.
Note: Any timeout specified here will be overridden by the remaining transaction timeout when executing within a transaction that has a timeout specified at the transaction level.
Set whether to use statements that return a specific type of ResultSet.
resultSetType | the ResultSet type |
---|
Set whether prepared statements should be capable of returning auto-generated keys.
Add anonymous parameters, specifying only their SQL types
as defined in the java.sql.Types
class.
Parameter ordering is significant. This method is an alternative
to the declareParameter(SqlParameter)
method, which should normally be preferred.
types | array of SQL types as defined in the
java.sql.Types class |
---|
InvalidDataAccessApiUsageException | if the operation is already compiled |
---|
Set whether to use statements that are capable of returning updatable ResultSets.
Return whether this operation accepts additional parameters that are given but not actually used. Applies in particular to parameter Maps.
The default is false
.
Check whether this operation has been compiled already; lazily compile it if not already compiled.
Automatically called by validateParameters
.
Subclasses must implement this template method to perform their own compilation. Invoked after this base class's compilation is complete.
Subclasses can assume that SQL and a DataSource have been supplied.
InvalidDataAccessApiUsageException | if the subclass hasn't been properly configured |
---|
Return a list of the declared SqlParameter
objects.
Return whether BLOB/CLOB parameters are supported for this kind of operation.
The default is true
.
Validate the named parameters passed to an execute method based on declared parameters.
Subclasses should invoke this method before every executeQuery()
or
update()
method.
parameters | parameter Map supplied. May be null . |
---|
InvalidDataAccessApiUsageException | if the parameters are invalid |
---|
Validate the parameters passed to an execute method based on declared parameters.
Subclasses should invoke this method before every executeQuery()
or update()
method.
parameters | parameters supplied (may be null ) |
---|
InvalidDataAccessApiUsageException | if the parameters are invalid |
---|