Java 类org.hibernate.jdbc.JDBCContext 实例源码

项目:cacheonix-core    文件:JDBCTransactionFactory.java   
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();
    }
项目:cacheonix-core    文件:JTATransaction.java   
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");
}
项目:lams    文件:SpringTransactionFactory.java   
@Override
public boolean isTransactionInProgress(
        JDBCContext jdbcContext, Context transactionContext, Transaction transaction) {

    return (transaction != null && transaction.isActive()) ||
            TransactionSynchronizationManager.isActualTransactionActive();
}
项目:spring4-understanding    文件:SpringTransactionFactory.java   
@Override
public boolean isTransactionInProgress(
        JDBCContext jdbcContext, Context transactionContext, Transaction transaction) {

    return (transaction != null && transaction.isActive()) ||
            TransactionSynchronizationManager.isActualTransactionActive();
}
项目:cacheonix-core    文件:CMTTransactionFactory.java   
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 );
    }

}
项目:cacheonix-core    文件:CacheSynchronization.java   
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;
}
项目:cacheonix-core    文件:SessionImpl.java   
/**
 * 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 );
    }
}
项目:cacheonix-core    文件:DummyJTAStyleTransationFactory.java   
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 );
    }
}
项目:lams    文件:SpringTransactionFactory.java   
@Override
public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext) {
    return new JDBCTransaction(jdbcContext, transactionContext);
}
项目:spring4-understanding    文件:SpringTransactionFactory.java   
@Override
public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext) {
    return new JDBCTransaction(jdbcContext, transactionContext);
}
项目:cacheonix-core    文件:CMTTransaction.java   
public CMTTransaction(JDBCContext jdbcContext, TransactionFactory.Context transactionContext) {
    this.jdbcContext = jdbcContext;
    this.transactionContext = transactionContext;
}
项目:cacheonix-core    文件:JTATransactionFactory.java   
public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext)
throws HibernateException {
    return new JTATransaction(context, utName, jdbcContext, transactionContext);
}
项目:cacheonix-core    文件:JDBCTransactionFactory.java   
public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext)
throws HibernateException {
    return new JDBCTransaction( jdbcContext, transactionContext );
}
项目:cacheonix-core    文件:CMTTransactionFactory.java   
public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext)
throws HibernateException {
    return new CMTTransaction(jdbcContext, transactionContext);
}
项目:cacheonix-core    文件:JDBCTransaction.java   
public JDBCTransaction(JDBCContext jdbcContext, TransactionFactory.Context transactionContext) {
    this.jdbcContext = jdbcContext;
    this.transactionContext = transactionContext;
}
项目:cacheonix-core    文件:SessionImpl.java   
public JDBCContext getJDBCContext() {
    errorIfClosed();
    checkTransactionSynchStatus();
    return jdbcContext;
}
项目:cacheonix-core    文件:SessionImpl.java   
/**
 * 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;
        }
    }
}
项目:cacheonix-core    文件:StatelessSessionImpl.java   
StatelessSessionImpl(Connection connection, SessionFactoryImpl factory) {
    super( factory );
    this.jdbcContext = new JDBCContext( this, connection, EmptyInterceptor.INSTANCE );
}
项目:cacheonix-core    文件:StatelessSessionImpl.java   
public JDBCContext getJDBCContext() {
    return jdbcContext;
}
项目:cacheonix-core    文件:DummyJTAStyleTransationFactory.java   
public Transaction createTransaction(
        JDBCContext jdbcContext,
        Context context) throws HibernateException {
    return new DummyTransactionAdapter();
}
项目:class-guard    文件:SpringTransactionFactory.java   
public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext) {
    return new JDBCTransaction(jdbcContext, transactionContext);
}
项目:class-guard    文件:SpringTransactionFactory.java   
public boolean isTransactionInProgress(
        JDBCContext jdbcContext, Context transactionContext, Transaction transaction) {

    return (transaction != null && transaction.isActive()) ||
            TransactionSynchronizationManager.isActualTransactionActive();
}
项目:cacheonix-core    文件:TransactionFactory.java   
/**
 * 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;
项目:cacheonix-core    文件:TransactionFactory.java   
/**
 * 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);
项目:cacheonix-core    文件:SessionImplementor.java   
public JDBCContext getJDBCContext();