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

The following examples show how to use org.hibernate.Transaction#wasRolledBack() . 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
Source File: HibernateSessionService.java    From livingdoc-core with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void commitTransaction() throws HibernateException {
    Transaction tx = threadTransaction.get();
    threadTransaction.set(null);
    if (tx != null && ! tx.wasCommitted() && ! tx.wasRolledBack()) {
        tx.commit();
    }
}
 
Example 2
Source File: HibernateSessionService.java    From livingdoc-core with GNU General Public License v3.0 5 votes vote down vote up
@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 File: HibernateUtil.java    From webdsl with 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
Source File: HibernateUtil.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Commit transaction
 */
public static void commit(Transaction tx) {
	if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) {
		tx.commit();
	}
}
 
Example 5
Source File: HibernateUtil.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Rollback transaction
 */
public static void rollback(Transaction tx) {
	if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) {
		tx.rollback();
	}
}
 
Example 6
Source File: HibernateUtil.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Commit transaction
 */
public static void commit(Transaction tx) {
	if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) {
		tx.commit();
	}
}
 
Example 7
Source File: HibernateUtil.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Rollback transaction
 */
public static void rollback(Transaction tx) {
	if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) {
		tx.rollback();
	}
}