Package net.sf.basedb.core.hibernate
Class ExecuteUpdateWork
java.lang.Object
net.sf.basedb.core.hibernate.ExecuteUpdateWork
- All Implemented Interfaces:
ReturningWork<Integer>
A JDBC work implementation that executes an update/insert/delete
query and returns the number of rows that was affected by the query.
By subclassing this class and overridding the
setParameters(PreparedStatement)
method it is possible to set parameters on the prepared statement before
the SQL is executed.- Version:
- 2.9
- Author:
- nicklas
- See Also:
- Last modified
- $Date: 2014-06-10 13:27:02 +0200 (ti, 10 jun 2014) $
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionexecute
(Connection connection) From the Work interface -----------------------protected void
This method should be overridden by subclasses that needs to set parameters on the statement that is going to be executed.
-
Field Details
-
sc
-
sql
-
-
Constructor Details
-
ExecuteUpdateWork
Create a new work item.- Parameters:
sc
- The session control to keep alive during the execution of the sql, or nullsql
- The sql to execute
-
-
Method Details
-
execute
From the Work interface ------------------------ Specified by:
execute
in interfaceReturningWork<Integer>
- Throws:
SQLException
-
setParameters
This method should be overridden by subclasses that needs to set parameters on the statement that is going to be executed. The default implementation does nothing. This method is called after the statement has been prepared withConnection.prepareStatement(String)
and before it is executed withPreparedStatement.executeUpdate()
.- Parameters:
ps
- The prepared statement- Throws:
SQLException
-