/*
 * Created on 2004-4-24
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package workflow.store.persistence;

import workflow.store.StoreConnection;
import workflow.store.spi.SpiDatabase;

/**
 * @author zosatapo
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public interface UserTransaction
{ 
  /**
   *  return the database that the transaction belongs to
   */
  public SpiDatabase   getDatabase();
  
  /**
   *  Return under store connection for this transaction 
   */
  public StoreConnection  getStoreConnection();   

  /**
   * Commits user transaction.
   *
   * @exception TransactionException If something unexpected happens.
   */
  public void commit() throws TransactionException;

  /**
   * Rollbacks user transaction. This method is called when commit
   * method fails.
   *
   * @exception TransactionException If something unexpected happens.
   */
  public void rollback() throws TransactionException;
  
  /**
   * Releases user transaction. Method <b>MUST</b> be called for each transaction.
   *
   * @exception TransactionException If something unexpected happens.
   */
  public void release() throws TransactionException;
}
