Dashboard Builder Commons 6.2.0.Beta2

org.jboss.dashboard.database.hibernate
Class HibernateTransaction

java.lang.Object
  extended by org.jboss.dashboard.database.hibernate.HibernateTransaction

public class HibernateTransaction
extends Object

A Hibernate transaction in the platform is always tied to a single thread. Every time a thread is executed an instance of this class is created and bounded to the current thread. The standard way to interact with the underlying transaction is to make use of the HibernateTxFragment idiom.

See Also:
HibernateTxFragment

Field Summary
protected  org.hibernate.Transaction tx
          The underlying Hibernate transaction
 
Method Summary
 void begin()
          Begin the transaction
protected  void close()
          Flush the transaction
protected  void commit()
          Commit the transaction
 void complete()
          Complete the transaction
 void error(Throwable t)
          Exception occurred during a transaction fragment
protected  void executeFragment(HibernateTxFragment fragment)
           
protected  void flush()
          Flush the transaction
static HibernateTransaction getCurrentTx()
          Get the current tx associated with the calling thread.
protected  HibernateTxFragment getFlusherFragment()
          Get the first fragment in the chain than has the flush flag enabled.
 String getId()
           
 org.hibernate.Session getSession()
           
 boolean isActive()
           
 boolean isRollback()
           
protected  void notifyAfterCommit(HibernateTxFragment fragment)
           
protected  void notifyAfterRollback(HibernateTxFragment fragment)
           
protected  void notifyBeforeCommit(HibernateTxFragment fragment)
           
protected  void notifyBeforeRollback(HibernateTxFragment fragment)
           
protected  void notifyListener(boolean before, HibernateTxFragment listener)
          Invoke the callbacks on a listener
protected  void notifyListeners(boolean before)
          Invoke the callbacks on listeners
protected  void rollback()
          Rollback the transaction
static Object runWork(HibernateWork work)
           
 void setId(String id)
           
 void setRollback(boolean rollback)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tx

protected org.hibernate.Transaction tx
The underlying Hibernate transaction

Method Detail

getCurrentTx

public static HibernateTransaction getCurrentTx()
Get the current tx associated with the calling thread. This method ensures that a tx instance is always available.


getId

public String getId()

setId

public void setId(String id)

getSession

public org.hibernate.Session getSession()

isRollback

public boolean isRollback()

setRollback

public void setRollback(boolean rollback)

isActive

public boolean isActive()

begin

public void begin()
           throws Exception
Begin the transaction

Throws:
Exception

complete

public void complete()
Complete the transaction


flush

protected void flush()
Flush the transaction


close

protected void close()
Flush the transaction


rollback

protected void rollback()
Rollback the transaction


commit

protected void commit()
Commit the transaction


error

public void error(Throwable t)
Exception occurred during a transaction fragment


executeFragment

protected final void executeFragment(HibernateTxFragment fragment)
                              throws Exception
Throws:
Exception

getFlusherFragment

protected HibernateTxFragment getFlusherFragment()
Get the first fragment in the chain than has the flush flag enabled.


notifyListeners

protected void notifyListeners(boolean before)
Invoke the callbacks on listeners


notifyListener

protected void notifyListener(boolean before,
                              HibernateTxFragment listener)
Invoke the callbacks on a listener


notifyBeforeCommit

protected void notifyBeforeCommit(HibernateTxFragment fragment)

notifyBeforeRollback

protected void notifyBeforeRollback(HibernateTxFragment fragment)

notifyAfterCommit

protected void notifyAfterCommit(HibernateTxFragment fragment)

notifyAfterRollback

protected void notifyAfterRollback(HibernateTxFragment fragment)

runWork

public static Object runWork(HibernateWork work)
                      throws Throwable
Throws:
Throwable

Dashboard Builder Commons 6.2.0.Beta2

Copyright © 2012-2014 JBoss by Red Hat. All Rights Reserved.