org.hibernate.jdbc
Class JDBCContext

java.lang.Object
  extended by org.hibernate.jdbc.JDBCContext
All Implemented Interfaces:
Serializable, ConnectionManager.Callback

public class JDBCContext
extends Object
implements Serializable, ConnectionManager.Callback

Acts as the mediary between "entity-mode related" sessions in terms of their interaction with the JDBC data store.

Author:
Steve Ebersole
See Also:
Serialized Form

Nested Class Summary
static interface JDBCContext.Context
           
 
Constructor Summary
JDBCContext(JDBCContext.Context owner, Connection connection, Interceptor interceptor)
           
 
Method Summary
 void afterNontransactionalQuery(boolean success)
          Called after executing a query outside the scope of a Hibernate or JTA transaction
 void afterTransactionBegin(Transaction tx)
          We cannot rely upon this method being called! It is only called if we are using Hibernate Transaction API.
 void afterTransactionCompletion(boolean success, Transaction tx)
           
 void beforeTransactionCompletion(Transaction tx)
           
 Connection borrowConnection()
           
 Connection connection()
           
 void connectionCleanedUp()
           
 void connectionOpened()
           
static JDBCContext deserialize(ObjectInputStream ois, JDBCContext.Context context, Interceptor interceptor)
          Custom deserialization routine used during deserialization of a Session/PersistenceContext for increased performance.
 ConnectionManager getConnectionManager()
           
 SessionFactoryImplementor getFactory()
           
 Transaction getTransaction()
           
 boolean isTransactionInProgress()
           
 boolean registerCallbackIfNecessary()
           
 boolean registerSynchronizationIfPossible()
           
 void serialize(ObjectOutputStream oos)
          Custom serialization routine used during serialization of a Session/PersistenceContext for increased performance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCContext

public JDBCContext(JDBCContext.Context owner,
                   Connection connection,
                   Interceptor interceptor)
Method Detail

connectionOpened

public void connectionOpened()
Specified by:
connectionOpened in interface ConnectionManager.Callback

connectionCleanedUp

public void connectionCleanedUp()
Specified by:
connectionCleanedUp in interface ConnectionManager.Callback

getFactory

public SessionFactoryImplementor getFactory()

getConnectionManager

public ConnectionManager getConnectionManager()

borrowConnection

public Connection borrowConnection()

connection

public Connection connection()
                      throws HibernateException
Throws:
HibernateException

registerCallbackIfNecessary

public boolean registerCallbackIfNecessary()

registerSynchronizationIfPossible

public boolean registerSynchronizationIfPossible()

isTransactionInProgress

public boolean isTransactionInProgress()
Specified by:
isTransactionInProgress in interface ConnectionManager.Callback

getTransaction

public Transaction getTransaction()
                           throws HibernateException
Throws:
HibernateException

beforeTransactionCompletion

public void beforeTransactionCompletion(Transaction tx)

afterTransactionBegin

public void afterTransactionBegin(Transaction tx)
We cannot rely upon this method being called! It is only called if we are using Hibernate Transaction API.


afterTransactionCompletion

public void afterTransactionCompletion(boolean success,
                                       Transaction tx)

afterNontransactionalQuery

public void afterNontransactionalQuery(boolean success)
Called after executing a query outside the scope of a Hibernate or JTA transaction


serialize

public void serialize(ObjectOutputStream oos)
               throws IOException
Custom serialization routine used during serialization of a Session/PersistenceContext for increased performance.

Parameters:
oos - The stream to which we should write the serial data.
Throws:
IOException

deserialize

public static JDBCContext deserialize(ObjectInputStream ois,
                                      JDBCContext.Context context,
                                      Interceptor interceptor)
                               throws IOException
Custom deserialization routine used during deserialization of a Session/PersistenceContext for increased performance.

Parameters:
ois - The stream from which to read the entry.
Throws:
IOException