org.infoglue.cms.util.workflow
Class DatabaseSession

java.lang.Object
  extended by org.infoglue.cms.util.workflow.DatabaseSession

public class DatabaseSession
extends java.lang.Object

A database session controls the lifecycle of a wrapped database object.


Constructor Summary
DatabaseSession()
          Default constructor.
 
Method Summary
 org.exolab.castor.jdo.Database getDB()
          Returns the wrapped database.
 void releaseDB()
          Releases the database.
 void setRollbackOnly()
          Sets the rollback only flag to true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseSession

public DatabaseSession()
Default constructor.

Method Detail

setRollbackOnly

public void setRollbackOnly()
Sets the rollback only flag to true.


getDB

public org.exolab.castor.jdo.Database getDB()
                                     throws com.opensymphony.workflow.WorkflowException
Returns the wrapped database. The database will be opened and the transaction will be started when this function is first called.

Returns:
the wrapped database object.
Throws:
com.opensymphony.workflow.WorkflowException - if an error occurs during the initializing of the transaction/database.

releaseDB

public void releaseDB()
               throws com.opensymphony.workflow.WorkflowException
Releases the database. If the rollback only flag has been set, the transaction is rolled back. Otherwise the transaction is commited. Finally the database is closed.

Throws:
com.opensymphony.workflow.WorkflowException - if an error occurs while releasing the transaction/database.


Copyright © 2005 InfoGlue.org All Rights Reserved.