org.davesag.generica.persistence.hibernate
Class HibernateTransaction

java.lang.Object
  extended byorg.davesag.generica.persistence.hibernate.HibernateTransaction
All Implemented Interfaces:
Manager, Transaction

public class HibernateTransaction
extends Object
implements Transaction, Manager

The HibernateTransaction delegates to an underlying Hibernate Transaction.

Since:
Generica 1.0
Version:
CVS Revision $Id: HibernateTransaction.java,v 1.5 2004/04/06 15:33:23 davesag Exp $
Author:
Dave Sag http://www.davesag.com

Field Summary
protected  Transaction theTransaction
          the Transaction we are delegating to
 
Constructor Summary
HibernateTransaction()
          default constructor
 
Method Summary
 void commit()
          commit this transaction.
 Object getDelegate()
          Get the object to delegate to.
 boolean isActive()
          test to see if this transaction is still active.
 void rollback()
          rollback this transaction.
 void setDelegate(Object delegate)
          Set the Hibernate Transaction to delegate to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theTransaction

protected Transaction theTransaction
the Transaction we are delegating to

Constructor Detail

HibernateTransaction

public HibernateTransaction()
default constructor

Method Detail

setDelegate

public void setDelegate(Object delegate)
                 throws ClassCastException
Set the Hibernate Transaction to delegate to.

Specified by:
setDelegate in interface Manager
Parameters:
delegate - The Hibernate Transaction to delegate to.
Throws:
ClassCastException - if the delegate was not a Hibernate Transaction.

getDelegate

public Object getDelegate()
Get the object to delegate to.

Specified by:
getDelegate in interface Manager
Returns:
The object being delegated to.

commit

public void commit()
            throws ArchiveException
commit this transaction.

Specified by:
commit in interface Transaction
Throws:
ArchiveException - if anything else went wrong.
DelegateException - if the underlying transaction has not been set.

rollback

public void rollback()
              throws ArchiveException
rollback this transaction.

Specified by:
rollback in interface Transaction
Throws:
ArchiveException - if anything went wrong.
DelegateException - if there was no underlying hibernate transaction to delegate to.

isActive

public boolean isActive()
                 throws ArchiveException
test to see if this transaction is still active.

Specified by:
isActive in interface Transaction
Returns:
true if the transaction is still active.
Throws:
ArchiveException - if anything went wrong.
DelegateException - if there was no underlying hibernate transaction to delegate to.


Dave Sag Generica API version 0.5.9 - (prerelease) Copyright 2003 - 2004 Dave Sag.