Example usage for org.hibernate TransactionException TransactionException

List of usage examples for org.hibernate TransactionException TransactionException

Introduction

In this page you can find the example usage for org.hibernate TransactionException TransactionException.

Prototype

public TransactionException(String message, Throwable cause) 

Source Link

Document

Constructs a TransactionException using the specified information.

Usage

From source file:org.xerela.zap.hibernate.internal.ZTransaction.java

License:Mozilla Public License

/**
 * /*  w  w  w  .  j  a  v a  2s .c  o m*/
 */
private void afterCommitRollback() {

    begun = false;

    if (callback) {
        // this method is a noop if there is a Synchronization!
        if (!newTransaction) {
            LOGGER.warn(SET_HIBERNATE_TRANSACTION_MANAGER_LOOKUP_CLASS_IF_CACHE_IS_ENABLED);
        }

        int status = Integer.MIN_VALUE;
        try {
            status = userTransaction.getStatus();
        } catch (Exception e) {
            throw new TransactionException("Could not determine transaction status after commit", e); //$NON-NLS-1$
        } finally {
            /*if (status!=Status.STATUS_COMMITTED && status!=Status.STATUS_ROLLEDBACK) {
             log.warn("Transaction not complete - you should set hibernate.transaction.manager_lookup_class if cache is enabled");
             //throw exception??
             }*/
            jdbcContext.afterTransactionCompletion(status == Status.STATUS_COMMITTED, this);
        }

    }
}