Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.jpa
Class JpaTransaction

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

All Implemented Interfaces:
  javax.persistence.EntityTransaction

    public class JpaTransaction

extends Object
implements javax.persistence.EntityTransaction

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

Field Summary
`protected javax.persistence.EntityManager` | `entityManager`
`protected boolean` | `rollbackOnly`
`protected Transaction` | `transaction`

Constructor Summary
`JpaTransaction(javax.persistence.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.
`protected void` | `reset()` Creates a new internal Cayenne transaction.
`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 javax.persistence.EntityManager entityManager

### transaction

    protected Transaction transaction

### rollbackOnly

    protected boolean rollbackOnly

Constructor Detail

### JpaTransaction

    public JpaTransaction(javax.persistence.EntityManager entityManager)

Method Detail

### reset

    protected void reset()

  Creates a new internal Cayenne transaction.

### begin

    public void begin()

  Start a resource transaction.

  Specified by:
    `begin` in interface `javax.persistence.EntityTransaction`
  Throws:
    `IllegalStateException` - if isActive() is true.

### commit

    public void commit()

  Commit the current transaction, writing any unflushed changes to the database.

  Specified by:
    `commit` in interface `javax.persistence.EntityTransaction`
  Throws:
    `IllegalStateException` - if isActive() is false.
    `javax.persistence.PersistenceException` - if the commit fails.

### rollback

    public void rollback()

  Roll back the current transaction.

  Specified by:
    `rollback` in interface `javax.persistence.EntityTransaction`
  Throws:
    `IllegalStateException` - if isActive() is false.
    `javax.persistence.PersistenceException` - if an unexpected error condition is encountered.

### isActive

    public boolean isActive()

  Indicate whether a transaction is in progress.

  Specified by:
    `isActive` in interface `javax.persistence.EntityTransaction`
  Throws:
    `javax.persistence.PersistenceException` - if an unexpected error condition is encountered.

### getRollbackOnly

    public boolean getRollbackOnly()

  Specified by:
    `getRollbackOnly` in interface `javax.persistence.EntityTransaction`

### setRollbackOnly

    public void setRollbackOnly()

  Specified by:
    `setRollbackOnly` in interface `javax.persistence.EntityTransaction`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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