org.apache.cayenne.jpa
Class JpaTransaction

java.lang.Object
  extended by org.apache.cayenne.jpa.JpaTransaction

public class JpaTransaction
extends Object

A JPA wrapper around a Cayenne Transaction. For more info see this page.


Field Summary
protected  EntityManager entityManager
           
protected  boolean rollbackOnly
           
protected  Transaction transaction
           
 
Constructor Summary
JpaTransaction(Transaction transaction, EntityManager entityManager)
           
 
Method Summary
 void begin()
          Start a resource transaction.
 void commit()
          Commit the current transaction, writing any unflushed changes to the database.
 boolean getRollbackOnly()
           
 boolean isActive()
          Indicate whether a transaction is in progress.
 void rollback()
          Roll back the current transaction.
 void setRollbackOnly()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entityManager

protected EntityManager entityManager

transaction

protected Transaction transaction

rollbackOnly

protected boolean rollbackOnly
Constructor Detail

JpaTransaction

public JpaTransaction(Transaction transaction,
                      EntityManager entityManager)
Method Detail

begin

public void begin()
Start a resource transaction.

Throws:
IllegalStateException - if isActive() is true.

commit

public void commit()
Commit the current transaction, writing any unflushed changes to the database.

Throws:
IllegalStateException - if isActive() is false.
PersistenceException - if the commit fails.

rollback

public void rollback()
Roll back the current transaction.

Throws:
IllegalStateException - if isActive() is false.
PersistenceException - if an unexpected error condition is encountered.

isActive

public boolean isActive()
Indicate whether a transaction is in progress.

Throws:
PersistenceException - if an unexpected error condition is encountered.

getRollbackOnly

public boolean getRollbackOnly()

setRollbackOnly

public void setRollbackOnly()


Copyright © 2001-2007 Apache Cayenne. All Rights Reserved.