Java Code Examples for org.hibernate.Transaction#wasRolledBack()

The following examples show how to use org.hibernate.Transaction#wasRolledBack() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public void commitTransaction() throws HibernateException {
    Transaction tx = threadTransaction.get();
    threadTransaction.set(null);
    if (tx != null && ! tx.wasCommitted() && ! tx.wasRolledBack()) {
        tx.commit();
    }
}
 
Example 2
@Override
public void rollbackTransaction() throws HibernateException {
    Transaction tx = threadTransaction.get();
    try {
        threadTransaction.set(null);
        if (tx != null && ! tx.wasCommitted() && ! tx.wasRolledBack()) {
            tx.rollback();
        }
    } finally {
        closeSession();
    }
}
 
Example 3
Source Project: webdsl   File: HibernateUtil.java    License: Apache License 2.0 5 votes vote down vote up
public void afterTransactionCompletion(Transaction tx) {
	try {
		if (tx.wasCommitted()) {
			afterTransactionCompletionCommitted_.afterTransactionCompletionCommitted_();
		}
		else if (tx.wasRolledBack()) {
			afterTransactionCompletionRolledBack_.afterTransactionCompletionRolledBack_();
		}
	}
	catch (Exception e) {
		ThreadLocalPage.get().exceptionInHibernateInterceptor = e;
	}
}
 
Example 4
/**
 * Commit transaction
 */
public static void commit(Transaction tx) {
	if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) {
		tx.commit();
	}
}
 
Example 5
/**
 * Rollback transaction
 */
public static void rollback(Transaction tx) {
	if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) {
		tx.rollback();
	}
}
 
Example 6
/**
 * Commit transaction
 */
public static void commit(Transaction tx) {
	if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) {
		tx.commit();
	}
}
 
Example 7
/**
 * Rollback transaction
 */
public static void rollback(Transaction tx) {
	if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) {
		tx.rollback();
	}
}