Example usage for javax.persistence EntityTransaction rollback

List of usage examples for javax.persistence EntityTransaction rollback

Introduction

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

Prototype

public void rollback();

Source Link

Document

Roll back the current resource transaction.

Usage

From source file:org.sigmah.server.dao.hibernate.TransactionalInterceptor.java

private Object attemptInvocation(MethodInvocation methodInvocation, EntityTransaction tx) throws Throwable {
    try {//from w w w .j  a v a 2 s . c  om
        return methodInvocation.proceed();
    } catch (Exception e) {
        // rollback database to original state
        tx.rollback();

        //propagate whatever exception is thrown anyway
        throw e;
    }
}

From source file:com.nandhootoo.services.NoteServiceImpl.java

public void merge(Note note) {
    EntityTransaction tx = null;
    try {//from   w w w.ja v a  2  s.  c  o m
        entityManager.merge(note);
    } catch (Exception ex) {
        if (tx != null && tx.isActive())
            tx.rollback();
        throw (RuntimeException) ex.getCause();
    }
}

From source file:com.nandhootoo.services.UserServiceImpl.java

public void merge(User user) {
    EntityTransaction tx = null;
    try {//from  ww  w .  ja va2  s.  com
        entityManager.merge(user);
    } catch (Exception ex) {
        if (tx != null && tx.isActive())
            tx.rollback();
        throw (RuntimeException) ex.getCause();
    }
}

From source file:com.nandhootoo.services.IssueServiceImpl.java

public void merge(Issue issue) {
    EntityTransaction tx = null;
    try {//from  w ww.ja v a2  s. co m
        entityManager.merge(issue);
    } catch (Exception ex) {
        if (tx != null && tx.isActive())
            tx.rollback();
        throw (RuntimeException) ex.getCause();
    }
}

From source file:com.nandhootoo.services.NoteServiceImpl.java

public void persist(Note note) {
    EntityTransaction tx = null;
    try {/*from ww w .j  a va 2s.  c  om*/
        entityManager.persist(note);
    } catch (Exception ex) {
        if (tx != null && tx.isActive())
            tx.rollback();
        throw (RuntimeException) ex.getCause();
    }
}

From source file:com.nandhootoo.services.StatusServiceImpl.java

public void merge(Status status) {
    EntityTransaction tx = null;
    try {//from w ww .  j  ava2  s . co  m
        entityManager.merge(status);
    } catch (Exception ex) {
        if (tx != null && tx.isActive())
            tx.rollback();
        throw (RuntimeException) ex.getCause();
    }
}

From source file:com.nandhootoo.services.UserServiceImpl.java

public void persist(User user) {
    EntityTransaction tx = null;
    try {//from   w  w w.  j  a v  a  2 s.  c o m
        entityManager.persist(user);
    } catch (Exception ex) {
        if (tx != null && tx.isActive())
            tx.rollback();
        throw (RuntimeException) ex.getCause();
    }
}

From source file:com.nandhootoo.services.IssueServiceImpl.java

public void persist(Issue issue) {
    EntityTransaction tx = null;
    try {//  w w w .  j  ava2 s .co  m
        entityManager.persist(issue);
    } catch (Exception ex) {
        if (tx != null && tx.isActive())
            tx.rollback();
        throw (RuntimeException) ex.getCause();
    }
}

From source file:com.nandhootoo.services.ProductServiceImpl.java

public void merge(Product product) {
    EntityTransaction tx = null;
    try {/*from w  ww .  ja  v a 2 s .  c  o m*/
        entityManager.merge(product);
    } catch (Exception ex) {
        if (tx != null && tx.isActive())
            tx.rollback();
        throw (RuntimeException) ex.getCause();
    }
}

From source file:com.nandhootoo.services.StatusServiceImpl.java

public void persist(Status status) {
    EntityTransaction tx = null;
    try {//from   w  w  w  .  jav a 2  s . c om
        entityManager.persist(status);
    } catch (Exception ex) {
        if (tx != null && tx.isActive())
            tx.rollback();
        throw (RuntimeException) ex.getCause();
    }
}