Example usage for org.hibernate.event.spi EventSource isTransactionInProgress

List of usage examples for org.hibernate.event.spi EventSource isTransactionInProgress

Introduction

In this page you can find the example usage for org.hibernate.event.spi EventSource isTransactionInProgress.

Prototype

boolean isTransactionInProgress();

Source Link

Document

Provides access to whether a transaction is currently in progress.

Usage

From source file:at.molindo.esi4j.module.hibernate.HibernateEventListener.java

License:Apache License

private EventSession findEventSession(EventSource hibernateSession) {
    if (hibernateSession.isTransactionInProgress()) {
        final Transaction transaction = hibernateSession.getTransaction();
        EventSession session = _map.get(transaction);
        if (session == null) {
            session = _batchedEventProcessor.startSession();

            transaction.registerSynchronization(new Esi4JHibernateSynchronization(transaction));

            _map.put(transaction, session);
        }/*from   w ww.  ja v a  2s .  co m*/
        return session;
    } else {
        return null;
    }
}

From source file:com.googlecode.hibernate.audit.extension.syncronization.DefaultTransactionSyncronization.java

License:Open Source License

private void checkForActiveTransaction(EventSource eventSource) {
    if (!eventSource.isTransactionInProgress()) {
        throw new HibernateException("No active transaction.");

    }/*from w  w w  . j  a  v a  2s . c  om*/
}