Example usage for org.hibernate SharedSessionContract getTransaction

List of usage examples for org.hibernate SharedSessionContract getTransaction

Introduction

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

Prototype

Transaction getTransaction();

Source Link

Document

Get the Transaction instance associated with this session.

Usage

From source file:org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStore.java

License:Apache License

/**
 * Rolls back hibernate session./*from   w ww . java2 s . c  o  m*/
 *
 * @param ses Hibernate session.
 * @param tx Cache ongoing transaction.
 */
private void rollback(SharedSessionContract ses, Transaction tx) {
    // Rollback only if there is no cache transaction,
    // otherwise sessionEnd() will do all required work.
    if (tx == null) {
        org.hibernate.Transaction hTx = ses.getTransaction();

        if (hTx != null && hTx.isActive())
            hTx.rollback();
    }
}

From source file:org.gridgain.grid.cache.store.hibernate.GridCacheHibernateBlobStore.java

License:Open Source License

/**
 * Rolls back hibernate session.//from   www.  j a  v  a2s.co  m
 *
 * @param ses Hibernate session.
 * @param tx Cache ongoing transaction.
 */
private void rollback(SharedSessionContract ses, GridCacheTx tx) {
    // Rollback only if there is no cache transaction,
    // otherwise txEnd() will do all required work.
    if (tx == null) {
        Transaction hTx = ses.getTransaction();

        if (hTx != null && hTx.isActive())
            hTx.rollback();
    }
}