3.2.4: 2013-12-06

net.sf.basedb.core.hibernate
Class SavePointWork<R>

java.lang.Object
  extended by net.sf.basedb.core.hibernate.SavePointWork<R>
All Implemented Interfaces:
JdbcWork<R>, Work

public class SavePointWork<R>
extends Object
implements JdbcWork<R>

A wrapper work that protects a parent work with a savepoint. Before executing the parent work, a Savepoint is created on the Connection. If the parent work results throws an SQLException the connection is rolled back to the savepoint. Other exceptions and a normal completion just releases the savepoint.

Since:
3.1
Author:
nicklas
Last modified
$Date: 2011-11-21 11:54:26 +0100 (Mon, 21 Nov 2011) $

Field Summary
private  JdbcWork<R> work
           
 
Constructor Summary
SavePointWork(JdbcWork<R> work)
          Create a new work item.
 
Method Summary
 void execute(Connection connection)
          From the Work interface -----------------------
 R getResult()
          Get the result of the work.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

work

private final JdbcWork<R> work
Constructor Detail

SavePointWork

public SavePointWork(JdbcWork<R> work)
Create a new work item.

Parameters:
work - The parent work
Method Detail

execute

public void execute(Connection connection)
             throws SQLException
From the Work interface -----------------------

Specified by:
execute in interface Work
Throws:
SQLException

getResult

public R getResult()
Description copied from interface: JdbcWork
Get the result of the work.

Specified by:
getResult in interface JdbcWork<R>
Returns:
The result from the parent work

3.2.4: 2013-12-06