- All Implemented Interfaces:
- Direct Known Subclasses:
public abstract class ResultSetWork<R> extends Object implements ReturningWork<R>
A work implementation that executes an SQL query on the connection, and returns a value that is picked by a subclass from the resulting
ResultSet. This class needs to be subclassed and implementors should provide an implementation of the
getResult(ResultSet)method. By overridding the
setParameters(PreparedStatement)method it is possible to set parameters on the prepared statement before the SQL is executed.
- Last modified
- $Date: 2014-06-10 13:27:02 +0200 (ti, 10 jun 2014) $
Modifier and Type Method Description
Connection connection)(From the Work interface -----------------------
protected abstract R
ResultSet rs)(This method needs to be overridden by subclasses to extract the result from the
()The sql that is executed by this work.
PreparedStatement ps)(This method should be overridden by subclasses that needs to set parameters on the statement that is going to be executed.
ResultSetWorkCreate a new work item.
sc- The session control to keep alive during the execution of the sql, or null
sql- The sql to execute
executeFrom the Work interface -----------------------
getSqlpublic String getSql()The sql that is executed by this work.
setParametersThis 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 with
Connection.prepareStatement(String)and before it is executed with
ps- The prepared statement
getResultThis method needs to be overridden by subclasses to extract the result from the
ResultSet. The result set will be closed after the call to this method.
rs- The result set to get the result from