Search in sources :

Example 1 with HttpException

use of org.webpieces.http.exception.HttpException in project webpieces by deanhiller.

the class TransactionFilter method commitOrRollback.

private Action commitOrRollback(EntityManager em, Action action, Throwable t) throws HttpException {
    EntityTransaction tx = em.getTransaction();
    if (t != null) {
        log.info("Transaction being rolled back");
        rollbackCloseSuppress(t, em, tx);
        if (t instanceof HttpException)
            // the platform needs the original HttpException to translate to an http code
            throw (HttpException) t;
        else
            throw SneakyThrow.sneak(t);
    }
    log.info("Transaction being committed");
    commit(tx, em);
    return action;
}
Also used : EntityTransaction(javax.persistence.EntityTransaction) HttpException(org.webpieces.http.exception.HttpException)

Aggregations

EntityTransaction (javax.persistence.EntityTransaction)1 HttpException (org.webpieces.http.exception.HttpException)1