public boolean isTransactionInProgress( JDBCContext jdbcContext, Context transactionContext, Transaction transaction) { // try { // // for JDBC-based transactions, we only want to return true // // here if we (this transaction) are managing the transaction // return transaction != null && // transaction.isActive() && // !jdbcContext.getConnectionManager().isAutoCommit(); // } // catch ( SQLException e ) { // // assume we are in auto-commit! // return false; // } return transaction != null && transaction.isActive(); }
public JTATransaction( InitialContext context, String utName, JDBCContext jdbcContext, TransactionFactory.Context transactionContext ) { this.jdbcContext = jdbcContext; this.transactionContext = transactionContext; log.debug("Looking for UserTransaction under: " + utName); try { ut = (UserTransaction) context.lookup(utName); } catch (NamingException ne) { log.error("Could not find UserTransaction in JNDI", ne); throw new TransactionException("Could not find UserTransaction in JNDI: ", ne); } if (ut==null) { throw new AssertionFailure("A naming service lookup returned null"); } log.debug("Obtained UserTransaction"); }
@Override public boolean isTransactionInProgress( JDBCContext jdbcContext, Context transactionContext, Transaction transaction) { return (transaction != null && transaction.isActive()) || TransactionSynchronizationManager.isActualTransactionActive(); }
public boolean isTransactionInProgress( JDBCContext jdbcContext, Context transactionContext, Transaction transaction) { try { return JTAHelper.isTransactionInProgress( transactionContext.getFactory().getTransactionManager().getTransaction() ); } catch( SystemException se ) { throw new TransactionException( "Unable to check transaction status", se ); } }
public CacheSynchronization( TransactionFactory.Context ctx, JDBCContext jdbcContext, Transaction transaction, org.hibernate.Transaction tx ) { this.ctx = ctx; this.jdbcContext = jdbcContext; this.transaction = transaction; this.hibernateTransaction = tx; }
/** * Constructor used for openSession(...) processing, as well as construction * of sessions for getCurrentSession(). * * @param connection The user-supplied connection to use for this session. * @param factory The factory from which this session was obtained * @param autoclose NOT USED * @param timestamp The timestamp for this session * @param interceptor The interceptor to be applied to this session * @param entityMode The entity-mode for this session * @param flushBeforeCompletionEnabled Should we auto flush before completion of transaction * @param autoCloseSessionEnabled Should we auto close after completion of transaction * @param connectionReleaseMode The mode by which we should release JDBC connections. */ SessionImpl( final Connection connection, final SessionFactoryImpl factory, final boolean autoclose, final long timestamp, final Interceptor interceptor, final EntityMode entityMode, final boolean flushBeforeCompletionEnabled, final boolean autoCloseSessionEnabled, final ConnectionReleaseMode connectionReleaseMode) { super( factory ); this.rootSession = null; this.timestamp = timestamp; this.entityMode = entityMode; this.interceptor = interceptor; this.listeners = factory.getEventListeners(); this.actionQueue = new ActionQueue( this ); this.persistenceContext = new StatefulPersistenceContext( this ); this.flushBeforeCompletionEnabled = flushBeforeCompletionEnabled; this.autoCloseSessionEnabled = autoCloseSessionEnabled; this.connectionReleaseMode = connectionReleaseMode; this.jdbcContext = new JDBCContext( this, connection, interceptor ); if ( factory.getStatistics().isStatisticsEnabled() ) { factory.getStatisticsImplementor().openSession(); } if ( log.isDebugEnabled() ) { log.debug( "opened session at timestamp: " + timestamp ); } }
public boolean isTransactionInProgress( JDBCContext jdbcContext, Context transactionContext, Transaction transaction) { try { return JTAHelper.isTransactionInProgress( DummyTransactionManager.INSTANCE.getCurrent() ) && ! JTAHelper.isMarkedForRollback( DummyTransactionManager.INSTANCE.getCurrent() ); } catch( SystemException e ) { throw new HibernateException( e ); } }
@Override public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext) { return new JDBCTransaction(jdbcContext, transactionContext); }
public CMTTransaction(JDBCContext jdbcContext, TransactionFactory.Context transactionContext) { this.jdbcContext = jdbcContext; this.transactionContext = transactionContext; }
public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext) throws HibernateException { return new JTATransaction(context, utName, jdbcContext, transactionContext); }
public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext) throws HibernateException { return new JDBCTransaction( jdbcContext, transactionContext ); }
public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext) throws HibernateException { return new CMTTransaction(jdbcContext, transactionContext); }
public JDBCTransaction(JDBCContext jdbcContext, TransactionFactory.Context transactionContext) { this.jdbcContext = jdbcContext; this.transactionContext = transactionContext; }
public JDBCContext getJDBCContext() { errorIfClosed(); checkTransactionSynchStatus(); return jdbcContext; }
/** * Used by JDK serialization... * * @param ois The input stream from which we are being read... * @throws IOException Indicates a general IO stream exception * @throws ClassNotFoundException Indicates a class resolution issue */ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { log.trace( "deserializing session" ); boolean isRootSession = ois.readBoolean(); connectionReleaseMode = ConnectionReleaseMode.parse( ( String ) ois.readObject() ); entityMode = EntityMode.parse( ( String ) ois.readObject() ); autoClear = ois.readBoolean(); flushMode = FlushMode.parse( ( String ) ois.readObject() ); cacheMode = CacheMode.parse( ( String ) ois.readObject() ); flushBeforeCompletionEnabled = ois.readBoolean(); autoCloseSessionEnabled = ois.readBoolean(); fetchProfile = ( String ) ois.readObject(); interceptor = ( Interceptor ) ois.readObject(); factory = SessionFactoryImpl.deserialize( ois ); listeners = factory.getEventListeners(); if ( isRootSession ) { jdbcContext = JDBCContext.deserialize( ois, this, interceptor ); } persistenceContext = StatefulPersistenceContext.deserialize( ois, this ); actionQueue = ActionQueue.deserialize( ois, this ); enabledFilters = ( Map ) ois.readObject(); childSessionsByEntityMode = ( Map ) ois.readObject(); Iterator iter = enabledFilters.values().iterator(); while ( iter.hasNext() ) { ( ( FilterImpl ) iter.next() ).afterDeserialize(factory); } if ( isRootSession && childSessionsByEntityMode != null ) { iter = childSessionsByEntityMode.values().iterator(); while ( iter.hasNext() ) { final SessionImpl child = ( ( SessionImpl ) iter.next() ); child.rootSession = this; child.jdbcContext = this.jdbcContext; } } }
StatelessSessionImpl(Connection connection, SessionFactoryImpl factory) { super( factory ); this.jdbcContext = new JDBCContext( this, connection, EmptyInterceptor.INSTANCE ); }
public JDBCContext getJDBCContext() { return jdbcContext; }
public Transaction createTransaction( JDBCContext jdbcContext, Context context) throws HibernateException { return new DummyTransactionAdapter(); }
public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext) { return new JDBCTransaction(jdbcContext, transactionContext); }
public boolean isTransactionInProgress( JDBCContext jdbcContext, Context transactionContext, Transaction transaction) { return (transaction != null && transaction.isActive()) || TransactionSynchronizationManager.isActualTransactionActive(); }
/** * Begin a transaction and return the associated <tt>Transaction</tt> instance. * * @param jdbcContext The jdbc context to which the transaction belongs * @param context The contract regarding the context in which this transaction will operate. * @return Transaction * @throws HibernateException */ public Transaction createTransaction(JDBCContext jdbcContext, Context context) throws HibernateException;
/** * Determine whether an underlying transaction is in progress. * <p/> * Mainly this is used in determining whether to register a * synchronization as well as whether or not to circumvent * auto flushing outside transactions. * * @param jdbcContext * @param transactionContext * @param transaction * @return true if an underlying transaction is know to be in effect. */ public boolean isTransactionInProgress(JDBCContext jdbcContext, Context transactionContext, Transaction transaction);
public JDBCContext getJDBCContext();