|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.jdbc.object.RdbmsOperation org.springframework.jdbc.object.SqlOperation org.springframework.jdbc.object.SqlUpdate
RdbmsOperation subclass representing a SQL update. Like a query, an update object is reusable. Like all RdbmsOperation objects, an update can have parameters and is defined in SQL.
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.
Field Summary |
Fields inherited from class org.springframework.jdbc.object.RdbmsOperation |
logger |
Constructor Summary | |
SqlUpdate()
Constructor to allow use as a JavaBean. |
|
SqlUpdate(javax.sql.DataSource ds,
java.lang.String sql)
Constructs an update object with a given DataSource and SQL to keep consistent with the |
|
SqlUpdate(javax.sql.DataSource ds,
java.lang.String sql,
int[] types)
Construct an update object with a given DataSource, SQL and anonymous parameters |
|
SqlUpdate(javax.sql.DataSource ds,
java.lang.String sql,
int[] types,
int maxRowsAffected)
Construct an update object with a given DataSource, SQL, anonymous parameters and specifying the maximum number of rows that may be affected. |
Method Summary | |
void |
setMaxRowsAffected(int max)
Set the maximum number of rows that may be affected by this update. |
void |
setRequiredRowsAffected(int rowsAffected)
Set the exact number of rows that must be affected by this update. |
int |
update()
Convenience method to execute an update with no parameters. |
int |
update(int p1)
Convenient method to execute an update given one int arg. |
int |
update(int p1,
int p2)
Convenient method to execute an update given two int args. |
int |
update(java.lang.Object[] args)
Generic method to execute the update given arguments. |
int |
update(java.lang.String p)
Convenient method to execute an update given one String arg. |
int |
update(java.lang.String p1,
java.lang.String p2)
Convenient method to execute an update given two String args. |
Methods inherited from class org.springframework.jdbc.object.SqlOperation |
compileInternal, getResultSetType, isUpdatableResults, newPreparedStatementCreator, onCompileInternal, setResultSetType, setUpdatableResults |
Methods inherited from class org.springframework.jdbc.object.RdbmsOperation |
afterPropertiesSet, compile, declareParameter, getDeclaredParameters, getJdbcTemplate, getSql, isCompiled, setDataSource, setJdbcTemplate, setSql, setTypes, validateParameters |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SqlUpdate()
public SqlUpdate(javax.sql.DataSource ds, java.lang.String sql)
ds
- DataSource to use to obtain connectionssql
- SQLpublic SqlUpdate(javax.sql.DataSource ds, java.lang.String sql, int[] types)
ds
- DataSource to use to obtain connectionssql
- SQLtypes
- anonymous parameter declarations.public SqlUpdate(javax.sql.DataSource ds, java.lang.String sql, int[] types, int maxRowsAffected)
ds
- DataSource to use to obtain connectionssql
- SQLtypes
- anonymous parameter declarations.maxRowsAffected
- the maximum number of rows that may
be affected by the update.Method Detail |
public void setMaxRowsAffected(int max)
max
- the maximum number of rows that can be affected
by this update without this class's update() method considering
it an error.public void setRequiredRowsAffected(int rowsAffected)
rowsAffected
- the exact number of rows that must be
affected by this update.public int update(java.lang.Object[] args) throws InvalidDataAccessApiUsageException
args
- array of object arguments
InvalidDataAccessApiUsageException
public int update()
public int update(int p1)
public int update(int p1, int p2)
public int update(java.lang.String p)
public int update(java.lang.String p1, java.lang.String p2)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |