Example usage for javax.persistence EntityTransaction getRollbackOnly

List of usage examples for javax.persistence EntityTransaction getRollbackOnly

Introduction

In this page you can find the example usage for javax.persistence EntityTransaction getRollbackOnly.

Prototype

public boolean getRollbackOnly();

Source Link

Document

Determine whether the current resource transaction has been marked for rollback.

Usage

From source file:test.unit.be.fedict.eid.applet.beta.PersistenceTest.java

@After
public void tearDown() throws Exception {
    EntityTransaction entityTransaction = this.entityManager.getTransaction();
    LOG.debug("entity manager open: " + this.entityManager.isOpen());
    LOG.debug("entity transaction active: " + entityTransaction.isActive());
    if (entityTransaction.isActive()) {
        if (entityTransaction.getRollbackOnly()) {
            entityTransaction.rollback();
        } else {/*  w  ww. jav a  2s.c  o  m*/
            entityTransaction.commit();
        }
    }
    this.entityManager.close();
}