Save This Page
Home » hibernate-distribution-3.3.1.GA-dist » org.hibernate » transaction » [javadoc | source]
org.hibernate.transaction
public class: JTATransactionFactory [javadoc | source]
java.lang.Object
   org.hibernate.transaction.JTATransactionFactory

All Implemented Interfaces:
    TransactionFactory

Factory for JTATransaction instances.

To be completely accurate to the JTA spec, JTA implementations should publish their contextual UserTransaction reference into JNDI. However, in practice there are quite a few stand-alone implementations intended for use outside of J2EE/JEE containers and which therefore do not publish their UserTransaction references into JNDI but which otherwise follow the aspects of the JTA specification. This TransactionFactory implementation can support both models.

For complete JTA implementations (including dependence on JNDI), the UserTransaction reference is obtained by a call to #resolveInitialContext . Hibernate will then attempt to locate the UserTransaction within this resolved InitialContext based on the namespace returned by #resolveUserTransactionName .

For the so-called stand-alone implementations, we do not care at all about the JNDI aspects just described. Here, the implementation would have a specific manner to obtain a reference to its contextual UserTransaction ; usually this would be a static code reference, but again it varies. Anyway, for each implementation the integration would need to override the #getUserTransaction method and return the appropriate thing.

Field Summary
public static final  String DEFAULT_USER_TRANSACTION_NAME     
protected  InitialContext initialContext     
protected  String userTransactionName     
Method from org.hibernate.transaction.JTATransactionFactory Summary:
areCallbacksLocalToHibernateTransactions,   configure,   createTransaction,   getDefaultReleaseMode,   getInitialContext,   getUserTransaction,   getUserTransactionName,   isTransactionInProgress,   isTransactionManagerRequired,   resolveInitialContext,   resolveUserTransactionName
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.hibernate.transaction.JTATransactionFactory Detail:
 public boolean areCallbacksLocalToHibernateTransactions() 
    {@inheritDoc}
 public  void configure(Properties props) throws HibernateException 
 public Transaction createTransaction(JDBCContext jdbcContext,
    Context transactionContext) throws HibernateException 
    {@inheritDoc}
 public ConnectionReleaseMode getDefaultReleaseMode() 
    {@inheritDoc}
 protected InitialContext getInitialContext() 
    Getter for property 'initialContext'.
 protected UserTransaction getUserTransaction() 
 protected String getUserTransactionName() 
    Getter for property 'userTransactionName'. The algorithm here is
 public boolean isTransactionInProgress(JDBCContext jdbcContext,
    Context transactionContext,
    Transaction transaction) 
    {@inheritDoc}
 public boolean isTransactionManagerRequired() 
    {@inheritDoc}
 protected final InitialContext resolveInitialContext(Properties properties) 
    Given the lot of Hibernate configuration properties, resolve appropriate reference to JNDI InitialContext .

    In general, the properties in which we are interested here all begin with hibernate.jndi. Especially important depending on your environment are hibernate.jndi.url and hibernate.jndi.class

 protected final String resolveUserTransactionName(Properties properties)