org.springframework.orm.toplink
Class UnitOfWorkCallback

java.lang.Object
  extended by org.springframework.orm.toplink.UnitOfWorkCallback
All Implemented Interfaces:
TopLinkCallback

public abstract class UnitOfWorkCallback
extends Object
implements TopLinkCallback

Convenient abstract implementation of the TopLinkCallback interface, exposing a UnitOfWork to perform write operations on.

The exposed UnitOfWork will either be be the active UnitOfWork of the current transaction, if any, or a temporarily acquired UnitOfWork that will be committed at the end of the operation.

Since:
1.2
Author:
Juergen Hoeller
See Also:
doInUnitOfWork(oracle.toplink.sessions.UnitOfWork), Session.getActiveUnitOfWork()

Constructor Summary
UnitOfWorkCallback()
           
 
Method Summary
 Object doInTopLink(oracle.toplink.sessions.Session session)
          Determines the UnitOfWork to work on (either the active UnitOfWork or a temporarily acquired UnitOfWork) and delegates to doInUnitOfWork.
protected abstract  Object doInUnitOfWork(oracle.toplink.sessions.UnitOfWork unitOfWork)
          Called with a UnitOfWork to work on, either the active UnitOfWork or a temporarily acquired UnitOfWork (as determined by the transaction status).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnitOfWorkCallback

public UnitOfWorkCallback()
Method Detail

doInTopLink

public final Object doInTopLink(oracle.toplink.sessions.Session session)
                         throws oracle.toplink.exceptions.TopLinkException
Determines the UnitOfWork to work on (either the active UnitOfWork or a temporarily acquired UnitOfWork) and delegates to doInUnitOfWork.

Specified by:
doInTopLink in interface TopLinkCallback
Parameters:
session - active TopLink Session
Returns:
a result object, or null if none
Throws:
oracle.toplink.exceptions.TopLinkException - if thrown by the TopLink API
See Also:
doInUnitOfWork(oracle.toplink.sessions.UnitOfWork)

doInUnitOfWork

protected abstract Object doInUnitOfWork(oracle.toplink.sessions.UnitOfWork unitOfWork)
                                  throws oracle.toplink.exceptions.TopLinkException
Called with a UnitOfWork to work on, either the active UnitOfWork or a temporarily acquired UnitOfWork (as determined by the transaction status).

Parameters:
unitOfWork - the TopLink UnitOfWork to perform write operations on
Returns:
a result object, or null if none
Throws:
oracle.toplink.exceptions.TopLinkException - in case of TopLink errors


Copyright © 2002-2008 The Spring Framework.