java.lang.Object | |||
↳ | org.springframework.jdbc.object.RdbmsOperation | ||
↳ | org.springframework.jdbc.object.SqlOperation | ||
↳ | org.springframework.jdbc.object.SqlUpdate |
Known Direct Subclasses |
Reusable operation object representing a SQL update.
This class provides a number of update
methods,
analogous to the execute
methods of query objects.
This class is concrete. Although it can be subclassed (for example to add a custom update method) it can easily be parameterized by setting SQL and declaring parameters.
Like all RdbmsOperation
classes that ship with the Spring
Framework, SqlQuery
instances are thread-safe after their
initialization is complete. That is, after they are constructed and configured
via their setter methods, they can be used safely from multiple threads.
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.jdbc.object.RdbmsOperation
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructor to allow use as a JavaBean.
| |||||||||||
Constructs an update object with a given DataSource and SQL.
| |||||||||||
Construct an update object with a given DataSource, SQL
and anonymous parameters.
| |||||||||||
Construct an update object with a given DataSource, SQL,
anonymous parameters and specifying the maximum number of rows
that may be affected.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Set the maximum number of rows that may be affected by this update.
| |||||||||||
Set the exact number of rows that must be affected by this update.
| |||||||||||
Convenient method to execute an update given two String args.
| |||||||||||
Convenient method to execute an update given two int args.
| |||||||||||
Convenient method to execute an update given two long args.
| |||||||||||
Convenient method to execute an update given one long arg.
| |||||||||||
Method to execute the update given arguments and
retrieve the generated keys using a KeyHolder.
| |||||||||||
Convenient method to execute an update given one int arg.
| |||||||||||
Convenience method to execute an update with no parameters.
| |||||||||||
Generic method to execute the update given parameters.
| |||||||||||
Convenient method to execute an update given one String arg.
| |||||||||||
Method to execute the update given arguments and
retrieve the generated keys using a KeyHolder.
| |||||||||||
Generic method to execute the update given named parameters.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Check the given number of affected rows against the
specified maximum number or required number.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.jdbc.object.SqlOperation
| |||||||||||
From class
org.springframework.jdbc.object.RdbmsOperation
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.beans.factory.InitializingBean
|
Constructor to allow use as a JavaBean. DataSource and SQL must be supplied before compilation and use.
Constructs an update object with a given DataSource and SQL.
ds | DataSource to use to obtain connections |
---|---|
sql | SQL statement to execute |
Construct an update object with a given DataSource, SQL and anonymous parameters.
ds | DataSource to use to obtain connections |
---|---|
sql | SQL statement to execute |
types | SQL types of the parameters, as defined in the
java.sql.Types class |
Construct an update object with a given DataSource, SQL, anonymous parameters and specifying the maximum number of rows that may be affected.
ds | DataSource to use to obtain connections |
---|---|
sql | SQL statement to execute |
types | SQL types of the parameters, as defined in the
java.sql.Types class |
maxRowsAffected | the maximum number of rows that may be affected by the update |
Set the maximum number of rows that may be affected by this update. The default value is 0, which does not limit the number of rows affected.
maxRowsAffected | the maximum number of rows that can be affected by this update without this class's update method considering it an error |
---|
Set the exact number of rows that must be affected by this update. The default value is 0, which allows any number of rows to be affected.
This is an alternative to setting the maximum number of rows that may be affected.
requiredRowsAffected | the exact number of rows that must be affected by this update without this class's update method considering it an error |
---|
Convenient method to execute an update given two String args.
DataAccessException |
---|
Convenient method to execute an update given two int args.
DataAccessException |
---|
Convenient method to execute an update given two long args.
DataAccessException |
---|
Convenient method to execute an update given one long arg.
DataAccessException |
---|
Method to execute the update given arguments and retrieve the generated keys using a KeyHolder.
params | array of parameter objects |
---|---|
generatedKeyHolder | KeyHolder that will hold the generated keys |
DataAccessException |
---|
Convenient method to execute an update given one int arg.
DataAccessException |
---|
Convenience method to execute an update with no parameters.
DataAccessException |
---|
Generic method to execute the update given parameters. All other update methods invoke this method.
params | array of parameters objects |
---|
DataAccessException |
---|
Convenient method to execute an update given one String arg.
DataAccessException |
---|
Method to execute the update given arguments and retrieve the generated keys using a KeyHolder.
paramMap | Map of parameter name to parameter object, matching named parameters specified in the SQL statement |
---|---|
generatedKeyHolder | KeyHolder that will hold the generated keys |
DataAccessException |
---|
Generic method to execute the update given named parameters. All other update methods invoke this method.
paramMap | Map of parameter name to parameter object, matching named parameters specified in the SQL statement |
---|
DataAccessException |
---|
Check the given number of affected rows against the specified maximum number or required number.
rowsAffected | the number of affected rows |
---|
JdbcUpdateAffectedIncorrectNumberOfRowsException | if the actually affected rows are out of bounds |
---|