[hibernate-commits] Hibernate SVN: r14449 - in core/trunk/core/src/main/java/org/hibernate: transaction and 1 other directory.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Tue Mar 18 01:48:53 EDT 2008


Author: steve.ebersole at jboss.com
Date: 2008-03-18 01:48:53 -0400 (Tue, 18 Mar 2008)
New Revision: 14449

Modified:
   core/trunk/core/src/main/java/org/hibernate/context/JTASessionContext.java
   core/trunk/core/src/main/java/org/hibernate/transaction/BESTransactionManagerLookup.java
   core/trunk/core/src/main/java/org/hibernate/transaction/BTMTransactionManagerLookup.java
   core/trunk/core/src/main/java/org/hibernate/transaction/CMTTransaction.java
   core/trunk/core/src/main/java/org/hibernate/transaction/CMTTransactionFactory.java
   core/trunk/core/src/main/java/org/hibernate/transaction/CacheSynchronization.java
   core/trunk/core/src/main/java/org/hibernate/transaction/JBossTransactionManagerLookup.java
   core/trunk/core/src/main/java/org/hibernate/transaction/JDBCTransaction.java
   core/trunk/core/src/main/java/org/hibernate/transaction/JDBCTransactionFactory.java
   core/trunk/core/src/main/java/org/hibernate/transaction/JNDITransactionManagerLookup.java
   core/trunk/core/src/main/java/org/hibernate/transaction/JOTMTransactionManagerLookup.java
   core/trunk/core/src/main/java/org/hibernate/transaction/JOnASTransactionManagerLookup.java
   core/trunk/core/src/main/java/org/hibernate/transaction/JRun4TransactionManagerLookup.java
   core/trunk/core/src/main/java/org/hibernate/transaction/JTATransaction.java
   core/trunk/core/src/main/java/org/hibernate/transaction/JTATransactionFactory.java
   core/trunk/core/src/main/java/org/hibernate/transaction/OC4JTransactionManagerLookup.java
   core/trunk/core/src/main/java/org/hibernate/transaction/OrionTransactionManagerLookup.java
   core/trunk/core/src/main/java/org/hibernate/transaction/ResinTransactionManagerLookup.java
   core/trunk/core/src/main/java/org/hibernate/transaction/SunONETransactionManagerLookup.java
   core/trunk/core/src/main/java/org/hibernate/transaction/TransactionFactory.java
   core/trunk/core/src/main/java/org/hibernate/transaction/TransactionFactoryFactory.java
   core/trunk/core/src/main/java/org/hibernate/transaction/TransactionManagerLookup.java
   core/trunk/core/src/main/java/org/hibernate/transaction/TransactionManagerLookupFactory.java
   core/trunk/core/src/main/java/org/hibernate/transaction/WebSphereExtendedJTATransactionLookup.java
   core/trunk/core/src/main/java/org/hibernate/transaction/WebSphereTransactionManagerLookup.java
Log:
HHH-1786 : more WebSphere JTA garbage;
copyright headers
clean-up

Modified: core/trunk/core/src/main/java/org/hibernate/context/JTASessionContext.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/context/JTASessionContext.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/context/JTASessionContext.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -35,7 +35,7 @@
  * the {@link #buildOrObtainSession()} method) for easier subclassing for custom
  * JTA-based session tracking logic (like maybe long-session semantics).
  *
- * @author <a href="mailto:steve at hibernate.org">Steve Ebersole </a>
+ * @author Steve Ebersole
  */
 public class JTASessionContext implements CurrentSessionContext {
 

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/BESTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/BESTransactionManagerLookup.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/BESTransactionManagerLookup.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,8 +1,31 @@
-//$Id: BESTransactionManagerLookup.java 4388 2004-08-20 07:44:37Z oneovthafew $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 /**
  * A <tt>TransactionManager</tt> lookup strategy for Borland ES.
+ *
  * @author Etienne Hardy
  */
 public final class BESTransactionManagerLookup extends JNDITransactionManagerLookup {

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/BTMTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/BTMTransactionManagerLookup.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/BTMTransactionManagerLookup.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,3 +1,26 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 import java.util.Properties;
@@ -3,15 +26,17 @@
 
 import javax.transaction.TransactionManager;
+import javax.transaction.Transaction;
 
 import org.hibernate.HibernateException;
 
 /**
  * TransactionManager lookup strategy for BTM
+ *
  * @author Ludovic Orban
  */
 public class BTMTransactionManagerLookup implements TransactionManagerLookup {
 
 	/**
-	 * @see org.hibernate.transaction.TransactionManagerLookup#getTransactionManager(Properties)
+	 * {@inheritDoc}
 	 */
 	public TransactionManager getTransactionManager(Properties props) throws HibernateException {
@@ -26,9 +51,16 @@
 	}
 
 	/**
-	 * @see org.hibernate.transaction.TransactionManagerLookup#getUserTransactionName()
+	 * {@inheritDoc}
 	 */
 	public String getUserTransactionName() {
 		return "java:comp/UserTransaction";
 	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	public Object getTransactionIdentifier(Transaction transaction) {
+		return transaction;
+	}
 }
\ No newline at end of file

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/CMTTransaction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/CMTTransaction.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/CMTTransaction.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: CMTTransaction.java 9680 2006-03-22 23:47:31Z epbernard $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 import javax.transaction.Status;
@@ -14,8 +36,13 @@
 import org.hibernate.util.JTAHelper;
 
 /**
- * Implements a basic transaction strategy for CMT transactions. All work is done 
- * in the context of the container managed transaction.
+ * Implements a basic transaction strategy for CMT transactions. All work is
+ * done in the context of the container managed transaction.
+ * <p/>
+ * The term 'CMT' is potentially misleading here; the pertinent point simply
+ * being that the transactions are being managed by something other than the
+ * Hibernate transaction mechanism.
+ *
  * @author Gavin King
  */
 public class CMTTransaction implements Transaction {
@@ -32,6 +59,9 @@
 		this.transactionContext = transactionContext;
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void begin() throws HibernateException {
 		if (begun) {
 			return;
@@ -50,6 +80,9 @@
 		jdbcContext.afterTransactionBegin(this);
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void commit() throws HibernateException {
 		if (!begun) {
 			throw new TransactionException("Transaction not successfully started");
@@ -68,6 +101,9 @@
 
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void rollback() throws HibernateException {
 		if (!begun) {
 			throw new TransactionException("Transaction not successfully started");
@@ -87,10 +123,18 @@
 
 	}
 
+	/**
+	 * Getter for property 'transaction'.
+	 *
+	 * @return Value for property 'transaction'.
+	 */
 	public javax.transaction.Transaction getTransaction() throws SystemException {
 		return transactionContext.getFactory().getTransactionManager().getTransaction();
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public boolean isActive() throws TransactionException {
 
 		if (!begun) return false;
@@ -111,6 +155,9 @@
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public boolean wasRolledBack() throws TransactionException {
 
 		if (!begun) return false;
@@ -131,6 +178,9 @@
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public boolean wasCommitted() throws TransactionException {
 
 		if ( !begun ) return false;
@@ -151,6 +201,9 @@
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void registerSynchronization(Synchronization sync) throws HibernateException {
 		try {
 			getTransaction().registerSynchronization(sync);
@@ -160,6 +213,9 @@
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void setTimeout(int seconds) {
 		throw new UnsupportedOperationException("cannot set transaction timeout in CMT");
 	}

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/CMTTransactionFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/CMTTransactionFactory.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/CMTTransactionFactory.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: CMTTransactionFactory.java 9595 2006-03-10 18:14:21Z steve.ebersole at jboss.com $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 import java.util.Properties;
@@ -13,9 +35,8 @@
 import javax.transaction.SystemException;
 
 /**
- * Factory for <tt>CMTTransaction</tt>.
+ * Factory for {@link CMTTransaction} instances.
  *
- * @see CMTTransaction
  * @author Gavin King
  */
 public class CMTTransactionFactory implements TransactionFactory {

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/CacheSynchronization.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/CacheSynchronization.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/CacheSynchronization.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: CacheSynchronization.java 9239 2006-02-08 22:34:34Z steveebersole $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 import javax.transaction.Status;
@@ -8,11 +30,15 @@
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
 import org.hibernate.TransactionException;
 import org.hibernate.jdbc.JDBCContext;
 import org.hibernate.util.JTAHelper;
 
 /**
+ * A JTA transaction synch used to allow the {@link org.hibernate.Session} to know about transaction
+ * events.
+ *
  * @author Gavin King
  */
 public final class CacheSynchronization implements Synchronization {
@@ -28,14 +54,16 @@
 			TransactionFactory.Context ctx, 
 			JDBCContext jdbcContext, 
 			Transaction transaction, 
-			org.hibernate.Transaction tx
-	) {
+			org.hibernate.Transaction tx) {
 		this.ctx = ctx;
 		this.jdbcContext = jdbcContext;
 		this.transaction = transaction;
 		this.hibernateTransaction = tx;
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void beforeCompletion() {
 		log.trace("transaction before completion callback");
 
@@ -77,6 +105,9 @@
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void afterCompletion(int status) {
 		if ( log.isTraceEnabled() ) {
 			log.trace("transaction after completion callback, status: " + status);
@@ -92,6 +123,9 @@
 		}
 	}
 	
+	/**
+	 * {@inheritDoc}
+	 */
 	public String toString() {
 		return CacheSynchronization.class.getName();
 	}

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JBossTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JBossTransactionManagerLookup.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JBossTransactionManagerLookup.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,8 +1,31 @@
-//$Id: JBossTransactionManagerLookup.java 8435 2005-10-18 16:23:33Z steveebersole $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 /**
- * A <tt>TransactionManager</tt> lookup strategy for JBoss
+ * A {@link TransactionManagerLookup} lookup strategy for JBoss AS.
+ *
  * @author Gavin King
  */
 public final class JBossTransactionManagerLookup extends JNDITransactionManagerLookup {

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JDBCTransaction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JDBCTransaction.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JDBCTransaction.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,10 +1,31 @@
-//$Id: JDBCTransaction.java 9595 2006-03-10 18:14:21Z steve.ebersole at jboss.com $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
-
 import javax.transaction.Status;
 import javax.transaction.Synchronization;
 
@@ -17,10 +38,13 @@
 import org.hibernate.jdbc.JDBCContext;
 
 /**
- * Implements a basic transaction strategy for JDBC connections.This is the
- * default <tt>Transaction</tt> implementation used if none is explicitly
- * specified.
- * @author Anton van Straaten, Gavin King
+ * {@link Transaction} implementation based on transaction management through
+ * a JDBC {@link java.sql.Connection}.
+ * <p/>
+ * This the Hibernate's default transaction strategy.
+ *
+ * @author Anton van Straaten
+ * @author Gavin King
  */
 public class JDBCTransaction implements Transaction {
 
@@ -43,6 +67,9 @@
 		this.transactionContext = transactionContext;
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void begin() throws HibernateException {
 		if (begun) {
 			return;
@@ -95,6 +122,9 @@
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void commit() throws HibernateException {
 		if (!begun) {
 			throw new TransactionException("Transaction not successfully started");
@@ -143,6 +173,9 @@
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void rollback() throws HibernateException {
 
 		if (!begun && !commitFailed) {
@@ -200,18 +233,30 @@
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public boolean wasRolledBack() {
 		return rolledBack;
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public boolean wasCommitted() {
 		return committed;
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public boolean isActive() {
 		return begun && ! ( rolledBack || committed | commitFailed );
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void registerSynchronization(Synchronization sync) throws HibernateException {
 		if (sync==null) throw new NullPointerException("null Synchronization");
 		if (synchronizations==null) {
@@ -249,6 +294,9 @@
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void setTimeout(int seconds) {
 		timeout = seconds;
 	}

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JDBCTransactionFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JDBCTransactionFactory.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JDBCTransactionFactory.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: JDBCTransactionFactory.java 10013 2006-06-11 17:00:19Z gavin.king at jboss.com $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 import java.util.Properties;
@@ -9,31 +31,49 @@
 import org.hibernate.jdbc.JDBCContext;
 
 /**
- * Factory for <tt>JDBCTransaction</tt>.
- * @see JDBCTransaction
+ * Factory for {@link JDBCTransaction} instances.
+ *
  * @author Anton van Straaten
  */
 public final class JDBCTransactionFactory implements TransactionFactory {
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public ConnectionReleaseMode getDefaultReleaseMode() {
 		return ConnectionReleaseMode.AFTER_TRANSACTION;
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext)
 	throws HibernateException {
 		return new JDBCTransaction( jdbcContext, transactionContext );
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void configure(Properties props) throws HibernateException {}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public boolean isTransactionManagerRequired() {
 		return false;
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public boolean areCallbacksLocalToHibernateTransactions() {
 		return true;
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public boolean isTransactionInProgress(
 			JDBCContext jdbcContext,
 	        Context transactionContext,

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JNDITransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JNDITransactionManagerLookup.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JNDITransactionManagerLookup.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,23 +1,56 @@
-//$Id: JNDITransactionManagerLookup.java 3890 2004-06-03 16:31:32Z steveebersole $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 import java.util.Properties;
 
 import javax.naming.NamingException;
 import javax.transaction.TransactionManager;
+import javax.transaction.Transaction;
 
 import org.hibernate.HibernateException;
 import org.hibernate.util.NamingHelper;
 
 /**
- * Locates a <tt>TransactionManager</tt> in JNDI.
+ * Template implementation of {@link TransactionManagerLookup} where the
+ * underlying {@link TransactionManager} is available via JNDI lookup at the
+ * specified location - {@link #getName}.
+ *
  * @author Gavin King
  */
 public abstract class JNDITransactionManagerLookup implements TransactionManagerLookup {
 
 	/**
-	 * @see org.hibernate.transaction.TransactionManagerLookup#getTransactionManager(java.util.Properties)
+	 * Get the JNDI namespace under wich we can locate the {@link TransactionManager}.
+	 *
+	 * @return The {@link TransactionManager} JNDI namespace
 	 */
+	protected abstract String getName();
+
+	/**
+	 * {@inheritDoc}
+	 */
 	public TransactionManager getTransactionManager(Properties props) throws HibernateException {
 		try {
 			return (TransactionManager) NamingHelper.getInitialContext(props).lookup( getName() );
@@ -27,8 +60,13 @@
 		}
 	}
 
-	protected abstract String getName();
-
+	/**
+	 * {@inheritDoc}
+	 */
+	public Object getTransactionIdentifier(Transaction transaction) {
+		// for sane JEE/JTA containers, the transaction itself functions as its identifier...
+		return transaction;
+	}
 }
 
 

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JOTMTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JOTMTransactionManagerLookup.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JOTMTransactionManagerLookup.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,3 +1,26 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 import java.util.Properties;
@@ -3,15 +26,17 @@
 
 import javax.transaction.TransactionManager;
+import javax.transaction.Transaction;
 
 import org.hibernate.HibernateException;
 
 /**
- * TransactionManager lookup strategy for JOTM
+ * {@link TransactionManagerLookup} strategy for JOTM
+ *
  * @author Low Heng Sin
  */
 public class JOTMTransactionManagerLookup implements TransactionManagerLookup {
 
 	/**
-	 * @see org.hibernate.transaction.TransactionManagerLookup#getTransactionManager(Properties)
+	 * {@inheritDoc}
 	 */
 	public TransactionManager getTransactionManager(Properties props) throws HibernateException {
@@ -25,10 +50,19 @@
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public String getUserTransactionName() {
 		return "java:comp/UserTransaction";
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
+	public Object getTransactionIdentifier(Transaction transaction) {
+		return transaction;
+	}
 }
 
 

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JOnASTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JOnASTransactionManagerLookup.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JOnASTransactionManagerLookup.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,3 +1,26 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 import java.util.Properties;
@@ -3,10 +26,10 @@
 
 import javax.transaction.TransactionManager;
+import javax.transaction.Transaction;
 
 import org.hibernate.HibernateException;
 
 /**
- * TransactionManager lookup strategy for JOnAS
- * @author ?
+ * {@link TransactionManagerLookup} strategy for JOnAS
  */
 public class JOnASTransactionManagerLookup implements TransactionManagerLookup {
@@ -25,9 +48,18 @@
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public String getUserTransactionName() {
 		return "java:comp/UserTransaction";
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
+	public Object getTransactionIdentifier(Transaction transaction) {
+		return transaction;
+	}
 }
 

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JRun4TransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JRun4TransactionManagerLookup.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JRun4TransactionManagerLookup.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,7 +1,31 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 /**
- * TransactionManager lookup strategy for JRun4
+ * {@link TransactionManagerLookup} strategy for JRun4 AS
+ *
  * @author Joseph Bissen
  */
 public class JRun4TransactionManagerLookup extends JNDITransactionManagerLookup {

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JTATransaction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JTATransaction.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JTATransaction.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: JTATransaction.java 9601 2006-03-11 18:17:43Z epbernard $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 import javax.naming.InitialContext;
@@ -19,16 +41,20 @@
 import org.hibernate.util.JTAHelper;
 
 /**
- * Implements a basic transaction strategy for JTA transactions. Instances check to
- * see if there is an existing JTA transaction. If none exists, a new transaction
- * is started. If one exists, all work is done in the existing context. The
- * following properties are used to locate the underlying <tt>UserTransaction</tt>:
- * <br><br>
- * <table>
- * <tr><td><tt>hibernate.jndi.url</tt></td><td>JNDI initial context URL</td></tr>
- * <tr><td><tt>hibernate.jndi.class</tt></td><td>JNDI provider class</td></tr>
- * <tr><td><tt>jta.UserTransaction</tt></td><td>JNDI name</td></tr>
- * </table>
+ * {@link Transaction} implementation based on transaction management through
+ * a JTA {@link UserTransaction}.  Similar to {@link CMTTransaction}, except
+ * here we are actually managing the transactions through the Hibernate
+ * transaction mechanism.
+ * <p/>
+ * Instances check to see if there is an existing JTA transaction.  If none
+ * exists, a new transaction is started; if one exists, all work is done in the
+ * existing context. The following properties are used to locate the underlying
+ * {@link UserTransaction}:<ul>
+ * <li><tt>hibernate.jndi.url</tt> : JNDI initial context URL</li>
+ * <li><tt>hibernate.jndi.class</tt> : JNDI provider class</li>
+ * <li><tt>jta.UserTransaction</tt> : JNDI namespace</li>
+ * </ul>
+ *
  * @author Gavin King
  */
 public class JTATransaction implements Transaction {
@@ -70,6 +96,9 @@
 		log.debug("Obtained UserTransaction");
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void begin() throws HibernateException {
 		if (begun) {
 			return;
@@ -121,6 +150,9 @@
 		jdbcContext.afterTransactionBegin(this);
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void commit() throws HibernateException {
 		if (!begun) {
 			throw new TransactionException("Transaction not successfully started");
@@ -166,6 +198,9 @@
 
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void rollback() throws HibernateException {
 		if (!begun && !commitFailed) {
 			throw new TransactionException("Transaction not successfully started");
@@ -236,6 +271,9 @@
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public boolean wasRolledBack() throws TransactionException {
 
 		//if (!begun) return false;
@@ -257,6 +295,9 @@
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public boolean wasCommitted() throws TransactionException {
 
 		//if (!begun || commitFailed) return false;
@@ -277,6 +318,9 @@
 		}
 	}
 	
+	/**
+	 * {@inheritDoc}
+	 */
 	public boolean isActive() throws TransactionException {
 
 		if (!begun || commitFailed || commitSucceeded) return false;
@@ -297,6 +341,9 @@
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void registerSynchronization(Synchronization sync) throws HibernateException {
 		if (getTransactionManager()==null) {
 			throw new IllegalStateException("JTA TransactionManager not available");
@@ -311,6 +358,11 @@
 		}
 	}
 
+	/**
+	 * Getter for property 'transactionManager'.
+	 *
+	 * @return Value for property 'transactionManager'.
+	 */
 	private TransactionManager getTransactionManager() {
 		return transactionContext.getFactory().getTransactionManager();
 	}
@@ -324,6 +376,9 @@
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public void setTimeout(int seconds) {
 		try {
 			ut.setTransactionTimeout(seconds);
@@ -333,6 +388,11 @@
 		}
 	}
 
+	/**
+	 * Getter for property 'userTransaction'.
+	 *
+	 * @return Value for property 'userTransaction'.
+	 */
 	protected UserTransaction getUserTransaction() {
 		return ut;
 	}

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JTATransactionFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JTATransactionFactory.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JTATransactionFactory.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: JTATransactionFactory.java 10347 2006-08-24 15:37:11Z steve.ebersole at jboss.com $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 import java.util.Properties;
@@ -10,6 +32,7 @@
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
 import org.hibernate.ConnectionReleaseMode;
 import org.hibernate.HibernateException;
 import org.hibernate.Transaction;
@@ -20,14 +43,13 @@
 import org.hibernate.util.JTAHelper;
 
 /**
- * Factory for <tt>JTATransaction</tt>.
+ * Factory for {@link JTATransaction} instances.
  *
- * @see JTATransaction
  * @author Gavin King
  */
 public class JTATransactionFactory implements TransactionFactory {
 
-	private static final Logger log = LoggerFactory.getLogger(JTATransactionFactory.class);
+	private static final Logger log = LoggerFactory.getLogger( JTATransactionFactory.class );
 	private static final String DEFAULT_USER_TRANSACTION_NAME = "java:comp/UserTransaction";
 
 	protected InitialContext context;
@@ -35,26 +57,30 @@
 
 	public void configure(Properties props) throws HibernateException {
 		try {
-			context = NamingHelper.getInitialContext(props);
+			context = NamingHelper.getInitialContext( props );
 		}
-		catch (NamingException ne) {
-			log.error("Could not obtain initial context", ne);
+		catch ( NamingException ne ) {
+			log.error( "Could not obtain initial context", ne );
 			throw new HibernateException( "Could not obtain initial context", ne );
 		}
 
-		utName = props.getProperty(Environment.USER_TRANSACTION);
+		utName = props.getProperty( Environment.USER_TRANSACTION );
 
-		if (utName==null) {
-			TransactionManagerLookup lookup = TransactionManagerLookupFactory.getTransactionManagerLookup(props);
-			if (lookup!=null) utName = lookup.getUserTransactionName();
+		if ( utName == null ) {
+			TransactionManagerLookup lookup = TransactionManagerLookupFactory.getTransactionManagerLookup( props );
+			if ( lookup != null ) {
+				utName = lookup.getUserTransactionName();
+			}
 		}
 
-		if (utName==null) utName = DEFAULT_USER_TRANSACTION_NAME;
+		if ( utName == null ) {
+			utName = DEFAULT_USER_TRANSACTION_NAME;
+		}
 	}
 
 	public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext)
-	throws HibernateException {
-		return new JTATransaction(context, utName, jdbcContext, transactionContext);
+			throws HibernateException {
+		return new JTATransaction( context, utName, jdbcContext, transactionContext );
 	}
 
 	public ConnectionReleaseMode getDefaultReleaseMode() {
@@ -71,10 +97,10 @@
 
 	public boolean isTransactionInProgress(
 			JDBCContext jdbcContext,
-	        Context transactionContext,
-	        Transaction transaction) {
+			Context transactionContext,
+			Transaction transaction) {
 		try {
-            // Essentially:
+			// Essentially:
 			// 1) If we have a local (Hibernate) transaction in progress
 			//      and it already has the UserTransaction cached, use that
 			//      UserTransaction to determine the status.
@@ -83,27 +109,27 @@
 			// 3) Finally, as the last resort, try to lookup the
 			//      UserTransaction via JNDI and use that to determine the
 			//      status.
-            if ( transaction != null ) {
+			if ( transaction != null ) {
 				UserTransaction ut = ( ( JTATransaction ) transaction ).getUserTransaction();
-                if ( ut != null ) {
-                    return JTAHelper.isInProgress( ut.getStatus() );
-                }
-            }
+				if ( ut != null ) {
+					return JTAHelper.isInProgress( ut.getStatus() );
+				}
+			}
 
-            if ( jdbcContext.getFactory().getTransactionManager() != null ) {
-                return JTAHelper.isInProgress( jdbcContext.getFactory().getTransactionManager().getStatus() );
-            }
-            else {
-                try {
+			if ( jdbcContext.getFactory().getTransactionManager() != null ) {
+				return JTAHelper.isInProgress( jdbcContext.getFactory().getTransactionManager().getStatus() );
+			}
+			else {
+				try {
 					UserTransaction ut = ( UserTransaction ) context.lookup( utName );
-			        return ut != null && JTAHelper.isInProgress( ut.getStatus() );
+					return ut != null && JTAHelper.isInProgress( ut.getStatus() );
 				}
 				catch ( NamingException ne ) {
 					throw new TransactionException( "Unable to locate UserTransaction to check status", ne );
 				}
-            }
+			}
 		}
-		catch( SystemException se ) {
+		catch ( SystemException se ) {
 			throw new TransactionException( "Unable to check transaction status", se );
 		}
 	}

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/OC4JTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/OC4JTransactionManagerLookup.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/OC4JTransactionManagerLookup.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,7 +1,30 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, 
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 /**
- * TransactionManagerLookup for the OC4J (Oracle) app-server.
+ * {@link TransactionManagerLookup} for the OC4J (Oracle) AS.
  * 
  * @author Stijn Janssens
  */

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/OrionTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/OrionTransactionManagerLookup.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/OrionTransactionManagerLookup.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,20 +1,45 @@
-//$Id: OrionTransactionManagerLookup.java 3890 2004-06-03 16:31:32Z steveebersole $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 /**
- * TransactionManager lookup strategy for Orion
+ * {@link TransactionManagerLookup} strategy for Orion
+ *
  * @author Gavin King
  */
-public class OrionTransactionManagerLookup
-extends JNDITransactionManagerLookup {
+public class OrionTransactionManagerLookup extends JNDITransactionManagerLookup {
 
 	/**
-	 * @see org.hibernate.transaction.JNDITransactionManagerLookup#getName()
+	 * {@inheritDoc}
 	 */
 	protected String getName() {
 		return "java:comp/UserTransaction";
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public String getUserTransactionName() {
 		return "java:comp/UserTransaction";
 	}

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/ResinTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/ResinTransactionManagerLookup.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/ResinTransactionManagerLookup.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,28 +1,47 @@
-//$Id: ResinTransactionManagerLookup.java 3890 2004-06-03 16:31:32Z steveebersole $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 /**
- * TransactionManager lookup strategy for Resin
+ * {@link TransactionManagerLookup} strategy for Resin
+ *
  * @author Aapo Laakkonen
  */
-public class ResinTransactionManagerLookup
-extends JNDITransactionManagerLookup {
+public class ResinTransactionManagerLookup extends JNDITransactionManagerLookup {
 
 	/**
-	 * @see org.hibernate.transaction.JNDITransactionManagerLookup#getName()
+	 * {@inheritDoc}
 	 */
 	protected String getName() {
 		return "java:comp/TransactionManager";
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public String getUserTransactionName() {
 		return "java:comp/UserTransaction";
 	}
 
 }
-
-
-
-
-
-

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/SunONETransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/SunONETransactionManagerLookup.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/SunONETransactionManagerLookup.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,18 +1,47 @@
-//$Id: SunONETransactionManagerLookup.java 11274 2007-03-12 00:18:38Z epbernard $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 /**
- * TransactionManager lookup strategy for Sun ONE Application Server 7 and above
+ * {@link TransactionManagerLookup} strategy for Sun ONE Application Server 7 and above
  * 
- * @author Robert Davidson, Sanjeev Krishnan
+ * @author Robert Davidson
+ * @author Sanjeev Krishnan
  * @author Emmanuel Bernard
  */
 public class SunONETransactionManagerLookup extends JNDITransactionManagerLookup {
 
+	/**
+	 * {@inheritDoc}
+	 */
 	protected String getName() {
 		return "java:appserver/TransactionManager";
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public String getUserTransactionName() {
 		return "java:comp/UserTransaction";
 	}

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/TransactionFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/TransactionFactory.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/TransactionFactory.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: TransactionFactory.java 9595 2006-03-10 18:14:21Z steve.ebersole at jboss.com $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 import java.util.Properties;
@@ -6,23 +28,31 @@
 import org.hibernate.ConnectionReleaseMode;
 import org.hibernate.HibernateException;
 import org.hibernate.Transaction;
+import org.hibernate.engine.SessionFactoryImplementor;
 import org.hibernate.jdbc.JDBCContext;
-import org.hibernate.engine.SessionFactoryImplementor;
 
 /**
- * An abstract factory for <tt>Transaction</tt> instances. Concrete implementations
- * are specified by <tt>hibernate.transaction.factory_class</tt>.<br>
- * <br>
+ * Contract for generating Hibernate {@link Transaction} instances.
+ * <p/>
+ * The concrete implementation to be used is specified by the
+ * {@link org.hibernate.cfg.Environment#TRANSACTION_STRATEGY} configuration
+ * setting.
+ * <p/>
  * Implementors must be threadsafe and should declare a public default constructor.
+ *
  * @see Transaction
  *
- * @author Anton van Straaten, Gavin King
+ * @author Anton van Straaten
+ * @author Gavin King
  */
 public interface TransactionFactory {
 
+	/**
+	 * Callback mechanism; a context is always a {@link org.hibernate.Session}
+	 * in the Hibernate usage.
+	 */
 	public static interface Context {
 		public SessionFactoryImplementor getFactory();
-//		public boolean isOpen();
 		public boolean isClosed();
 
 		public boolean isFlushModeNever();
@@ -39,35 +69,41 @@
 	 * @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
+	 * @throws HibernateException Indicates a problem generating a transaction instance
 	 */
 	public Transaction createTransaction(JDBCContext jdbcContext, Context context) throws HibernateException;
 
 	/**
 	 * Configure from the given properties.
-	 * @param props
-	 * @throws HibernateException
+	 *
+	 * @param props The configuration properties.
+	 * @throws HibernateException Indicates a problem configuring this factory.
 	 */
 	public void configure(Properties props) throws HibernateException;
 	
 	/**
-	 * Get the default connection release mode
+	 * Get the default connection release mode.
+	 *
+	 * @return The default release mode associated with this strategy
 	 */
 	public ConnectionReleaseMode getDefaultReleaseMode();
 	
 	/**
 	 * Do we require access to the JTA TransactionManager for
 	 * this strategy?
+	 *
+	 * @return True if this strategy requires access to the JTA TransactionManager;
+	 * false otherwise.
 	 */
 	public boolean isTransactionManagerRequired();
 
 	/**
 	 * Are all transaction callbacks local to Hibernate Transactions?
-	 * Or can the callbacks originate from some other source (e.g.
-	 * a JTA Synchronization).
+	 * Or can the callbacks originate from some other source (e.g. a JTA
+	 * Synchronization).
 	 *
-	 * @return true if callbacks only ever originate from
-	 * the Hibernate {@link Transaction}; false otherwise.
+	 * @return true if callbacks only ever originate from the Hibernate
+	 * {@link Transaction}; false otherwise.
 	 */
 	public boolean areCallbacksLocalToHibernateTransactions();
 
@@ -78,9 +114,9 @@
 	 * synchronization as well as whether or not to circumvent
 	 * auto flushing outside transactions.
 	 *
-	 * @param jdbcContext
-	 * @param transactionContext
-	 * @param transaction
+	 * @param jdbcContext The JDBC context
+	 * @param transactionContext The transaction context
+	 * @param transaction The Hibernate transaction
 	 * @return true if an underlying transaction is know to be in effect.
 	 */
 	public boolean isTransactionInProgress(JDBCContext jdbcContext, Context transactionContext, Transaction transaction);

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/TransactionFactoryFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/TransactionFactoryFactory.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/TransactionFactoryFactory.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,3 +1,26 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 import java.util.Properties;
@@ -10,47 +33,55 @@
 import org.hibernate.util.ReflectHelper;
 
 /**
+ * Helper for creating {@link TransactionFactory} instances.
+ *
  * @author Gavin King
  */
 public final class TransactionFactoryFactory {
 
-	private static final Logger log = LoggerFactory.getLogger(TransactionFactoryFactory.class);
+	private static final Logger log = LoggerFactory.getLogger( TransactionFactoryFactory.class );
 
 	/**
-	 * Obtain a TransactionFactory with the transaction handling strategy
-	 * specified by the given Properties.
+	 * Create an appropriate transaction factory based on the given configuration
+	 * properties.
 	 *
 	 * @param transactionProps transaction properties
-	 * @return TransactionFactory
-	 * @throws HibernateException
+	 *
+	 * @return The appropriate transaction factory.
+	 *
+	 * @throws HibernateException Indicates a problem creating the appropriate
+	 * transaction factory.
 	 */
 	public static TransactionFactory buildTransactionFactory(Properties transactionProps) throws HibernateException {
-
-		String strategyClassName = transactionProps.getProperty(Environment.TRANSACTION_STRATEGY);
-		if (strategyClassName==null) {
-			log.info("Using default transaction strategy (direct JDBC transactions)");
+		String strategyClassName = transactionProps.getProperty( Environment.TRANSACTION_STRATEGY );
+		if ( strategyClassName == null ) {
+			log.info( "Using default transaction strategy (direct JDBC transactions)" );
 			return new JDBCTransactionFactory();
 		}
-		log.info("Transaction strategy: " + strategyClassName);
+		log.info( "Transaction strategy: " + strategyClassName );
 		TransactionFactory factory;
 		try {
-			factory = (TransactionFactory) ReflectHelper.classForName(strategyClassName).newInstance();
+			factory = ( TransactionFactory ) ReflectHelper.classForName( strategyClassName ).newInstance();
 		}
-		catch (ClassNotFoundException e) {
-			log.error("TransactionFactory class not found", e);
-			throw new HibernateException("TransactionFactory class not found: " + strategyClassName);
+		catch ( ClassNotFoundException e ) {
+			log.error( "TransactionFactory class not found", e );
+			throw new HibernateException( "TransactionFactory class not found: " + strategyClassName );
 		}
-		catch (IllegalAccessException e) {
-			log.error("Failed to instantiate TransactionFactory", e);
-			throw new HibernateException("Failed to instantiate TransactionFactory: " + e);
+		catch ( IllegalAccessException e ) {
+			log.error( "Failed to instantiate TransactionFactory", e );
+			throw new HibernateException( "Failed to instantiate TransactionFactory: " + e );
 		}
-		catch (java.lang.InstantiationException e) {
-			log.error("Failed to instantiate TransactionFactory", e);
-			throw new HibernateException("Failed to instantiate TransactionFactory: " + e);
+		catch ( java.lang.InstantiationException e ) {
+			log.error( "Failed to instantiate TransactionFactory", e );
+			throw new HibernateException( "Failed to instantiate TransactionFactory: " + e );
 		}
-		factory.configure(transactionProps);
+		factory.configure( transactionProps );
 		return factory;
 	}
 
-	private TransactionFactoryFactory() {}
+	/**
+	 * Disallow instantiation
+	 */
+	private TransactionFactoryFactory() {
+	}
 }

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/TransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/TransactionManagerLookup.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/TransactionManagerLookup.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,33 +1,74 @@
-//$Id: TransactionManagerLookup.java 3890 2004-06-03 16:31:32Z steveebersole $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 import java.util.Properties;
+import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 
 import org.hibernate.HibernateException;
 
 /**
- * Concrete implementations locate and return the JTA
- * <tt>TransactionManager</tt>.
+ * Contract for locating the JTA {@link TransactionManager} on given platform.
+ * <p/>
+ * NOTE: this contract has expanded over time, and basically is a platform
+ * abstraction contract for JTA-related information.
+ *
  * @author Gavin King
  */
 public interface TransactionManagerLookup {
 
 	/**
-	 * Obtain the JTA <tt>TransactionManager</tt>
+	 * Obtain the JTA {@link TransactionManager}.
+	 *
+	 * @param props The configuration properties.
+	 * @return The JTA {@link TransactionManager}.
+	 *
+	 * @throws HibernateException Indicates problem locating {@link TransactionManager}.
 	 */
 	public TransactionManager getTransactionManager(Properties props) throws HibernateException;
 
 	/**
-	 * Return the JNDI name of the JTA <tt>UserTransaction</tt>
-	 * or <tt>null</tt> (optional operation).
+	 * Return the JNDI namespace of the JTA
+	 * {@link javax.transaction.UserTransaction} for this platform or <tt>null</tt>;
+	 * optional operation.
+	 *
+	 * @return The JNDI namespace where we can locate the
+	 * {@link javax.transaction.UserTransaction} for this platform.
 	 */
 	public String getUserTransactionName();
 
+	/**
+	 * Determine an identifier for the given transaction appropriate for use in caching/lookup usages.
+	 * <p/>
+	 * Generally speaking the transaction itself will be returned here.  This method was added specifically
+	 * for use in WebSphere and other unfriendly JEE containers (although WebSphere is still the only known
+	 * such brain-dead, sales-driven impl).
+	 *
+	 * @param transaction The transaction to be identified.
+	 * @return An appropropriate identifier
+	 */
+	public Object getTransactionIdentifier(Transaction transaction);
 }
 
-
-
-
-
-

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/TransactionManagerLookupFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/TransactionManagerLookupFactory.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/TransactionManagerLookupFactory.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: TransactionManagerLookupFactory.java 11412 2007-04-17 14:38:51Z max.andersen at jboss.com $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 import java.util.Properties;
@@ -13,38 +35,61 @@
 import org.hibernate.util.ReflectHelper;
 
 /**
+ * Helper for generating {@link TransactionManagerLookup} instances.
+ *
  * @author Gavin King
  */
 public final class TransactionManagerLookupFactory {
 
 	private static final Logger log = LoggerFactory.getLogger(TransactionManagerLookupFactory.class);
 
-	private TransactionManagerLookupFactory() {}
+	/**
+	 * Disallow instantiation
+	 */
+	private TransactionManagerLookupFactory() {
+	}
 
-	public static final TransactionManager getTransactionManager(Properties props) throws HibernateException {
-		log.info("obtaining TransactionManager");
-		return getTransactionManagerLookup(props).getTransactionManager(props);
+	/**
+	 * Convenience method for locating the JTA {@link TransactionManager} from the
+	 * given platform config.
+	 * <p/>
+	 * Same as calling {@link #getTransactionManager}.getTransactionManager( props )
+	 *
+	 * @param props The properties representing the platform config
+	 * @return The located {@link TransactionManager}
+	 * @throws HibernateException Indicates a problem either (a) generatng the
+	 * {@link TransactionManagerLookup} or (b) asking it to locate the {@link TransactionManager}.
+	 */
+	public static TransactionManager getTransactionManager(Properties props) throws HibernateException {
+		log.info( "obtaining TransactionManager" );
+		return getTransactionManagerLookup( props ).getTransactionManager( props );
 	}
 
-	public static final TransactionManagerLookup getTransactionManagerLookup(Properties props) throws HibernateException {
-
-		String tmLookupClass = props.getProperty(Environment.TRANSACTION_MANAGER_STRATEGY);
-		if (tmLookupClass==null) {
-			log.info("No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)");
+	/**
+	 * Generate the appropriate {@link TransactionManagerLookup} given the
+	 * config settings being passed.
+	 *
+	 * @param props The config settings
+	 * @return The appropriate {@link TransactionManagerLookup}
+	 * @throws HibernateException Indicates problem generating {@link TransactionManagerLookup}
+	 */
+	public static TransactionManagerLookup getTransactionManagerLookup(Properties props) throws HibernateException {
+		String tmLookupClass = props.getProperty( Environment.TRANSACTION_MANAGER_STRATEGY );
+		if ( tmLookupClass == null ) {
+			log.info( "No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)" );
 			return null;
 		}
 		else {
-
-			log.info("instantiating TransactionManagerLookup: " + tmLookupClass);
-
+			log.info( "instantiating TransactionManagerLookup: " + tmLookupClass );
 			try {
-				TransactionManagerLookup lookup = (TransactionManagerLookup) ReflectHelper.classForName(tmLookupClass).newInstance();
-				log.info("instantiated TransactionManagerLookup");
+				TransactionManagerLookup lookup = ( TransactionManagerLookup )
+						ReflectHelper.classForName( tmLookupClass ).newInstance();
+				log.info( "instantiated TransactionManagerLookup" );
 				return lookup;
 			}
-			catch (Exception e) {
-				log.error("Could not instantiate TransactionManagerLookup", e);
-				throw new HibernateException("Could not instantiate TransactionManagerLookup '" + tmLookupClass + "'");
+			catch ( Exception e ) {
+				log.error( "Could not instantiate TransactionManagerLookup", e );
+				throw new HibernateException( "Could not instantiate TransactionManagerLookup '" + tmLookupClass + "'" );
 			}
 		}
 	}

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/WebSphereExtendedJTATransactionLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/WebSphereExtendedJTATransactionLookup.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/WebSphereExtendedJTATransactionLookup.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,4 +1,26 @@
-//$Id: WebSphereExtendedJTATransactionLookup.java 11498 2007-05-09 14:55:16Z steve.ebersole at jboss.com $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 import java.lang.reflect.InvocationHandler;
@@ -40,14 +62,28 @@
  */
 public class WebSphereExtendedJTATransactionLookup implements TransactionManagerLookup {
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public TransactionManager getTransactionManager(Properties props) {
 		return new TransactionManagerAdapter( props );
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public String getUserTransactionName() {
 		return "java:comp/UserTransaction";
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
+	public Object getTransactionIdentifier(Transaction transaction) {
+		// WebSphere, however, is not a sane JEE/JTA container...
+		return new Integer( transaction.hashCode() );
+	}
+
 	public static class TransactionManagerAdapter implements TransactionManager {
 		private final Properties properties;
 		private final Class synchronizationCallbackClass;
@@ -75,38 +111,65 @@
 			}
 		}
 
+		/**
+		 * {@inheritDoc}
+		 */
 		public void begin() throws NotSupportedException, SystemException {
 			throw new UnsupportedOperationException();
 		}
 
+		/**
+		 * {@inheritDoc}
+		 */
 		public void commit() throws UnsupportedOperationException {
 			throw new UnsupportedOperationException();
 		}
 
+		/**
+		 * {@inheritDoc}
+		 */
 		public int getStatus() throws SystemException {
 			return getTransaction() == null ? Status.STATUS_NO_TRANSACTION : getTransaction().getStatus();
 		}
 
+		/**
+		 * {@inheritDoc}
+		 */
 		public Transaction getTransaction() throws SystemException {
 			return new TransactionAdapter( properties );
 		}
 
+		/**
+		 * {@inheritDoc}
+		 */
 		public void resume(Transaction txn) throws UnsupportedOperationException {
 			throw new UnsupportedOperationException();
 		}
 
+		/**
+		 * {@inheritDoc}
+		 */
 		public void rollback() throws UnsupportedOperationException {
 			throw new UnsupportedOperationException();
 		}
 
+		/**
+		 * {@inheritDoc}
+		 */
 		public void setRollbackOnly() throws UnsupportedOperationException {
 			throw new UnsupportedOperationException();
 		}
 
+		/**
+		 * {@inheritDoc}
+		 */
 		public void setTransactionTimeout(int i) throws UnsupportedOperationException {
 			throw new UnsupportedOperationException();
 		}
 
+		/**
+		 * {@inheritDoc}
+		 */
 		public Transaction suspend() throws UnsupportedOperationException {
 			throw new UnsupportedOperationException();
 		}
@@ -125,6 +188,9 @@
 				}
 			}
 
+			/**
+			 * {@inheritDoc}
+			 */
 			public void registerSynchronization(final Synchronization synchronization)
 					throws RollbackException, IllegalStateException,
 					SystemException {
@@ -167,16 +233,27 @@
 
 			}
 
+			/**
+			 * {@inheritDoc}
+			 */
 			public int hashCode() {
 				return getLocalId().hashCode();
 			}
 
+			/**
+			 * {@inheritDoc}
+			 */
 			public boolean equals(Object other) {
 				if ( !(other instanceof TransactionAdapter) ) return false;
 				TransactionAdapter that = (TransactionAdapter) other;
 				return getLocalId().equals( that.getLocalId() );
 			}
 
+			/**
+			 * Getter for property 'localId'.
+			 *
+			 * @return Value for property 'localId'.
+			 */
 			private Object getLocalId() throws HibernateException {
 				try {
 					return getLocalIdMethod.invoke( extendedJTATransaction, null );
@@ -186,27 +263,45 @@
 				}
 			}
 
+			/**
+			 * {@inheritDoc}
+			 */
 			public void commit() throws UnsupportedOperationException {
 				throw new UnsupportedOperationException();
 			}
 
+			/**
+			 * {@inheritDoc}
+			 */
 			public boolean delistResource(XAResource resource, int i) throws UnsupportedOperationException {
 				throw new UnsupportedOperationException();
 			}
 
+			/**
+			 * {@inheritDoc}
+			 */
 			public boolean enlistResource(XAResource resource) throws UnsupportedOperationException {
 				throw new UnsupportedOperationException();
 			}
 
+			/**
+			 * {@inheritDoc}
+			 */
 			public int getStatus() {
 				return new Integer(0).equals( getLocalId() ) ?
 						Status.STATUS_NO_TRANSACTION : Status.STATUS_ACTIVE;
 			}
 
+			/**
+			 * {@inheritDoc}
+			 */
 			public void rollback() throws UnsupportedOperationException {
 				throw new UnsupportedOperationException();
 			}
 
+			/**
+			 * {@inheritDoc}
+			 */
 			public void setRollbackOnly() throws UnsupportedOperationException {
 				throw new UnsupportedOperationException();
 			}

Modified: core/trunk/core/src/main/java/org/hibernate/transaction/WebSphereTransactionManagerLookup.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/WebSphereTransactionManagerLookup.java	2008-03-17 22:17:35 UTC (rev 14448)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/WebSphereTransactionManagerLookup.java	2008-03-18 05:48:53 UTC (rev 14449)
@@ -1,9 +1,32 @@
-//$Id: WebSphereTransactionManagerLookup.java 8469 2005-10-26 22:03:03Z oneovthafew $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.transaction;
 
 import java.util.Properties;
 
 import javax.transaction.TransactionManager;
+import javax.transaction.Transaction;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -11,7 +34,8 @@
 import org.hibernate.HibernateException;
 
 /**
- * TransactionManager lookup strategy for WebSphere (versions 4, 5.0 and 5.1)
+ * {@link TransactionManagerLookup} strategy for WebSphere (versions 4, 5.0 and 5.1)
+ *
  * @author Gavin King
  */
 public class WebSphereTransactionManagerLookup implements TransactionManagerLookup {
@@ -20,49 +44,64 @@
 	private final int wsVersion;
 	private final Class tmfClass;
 	
+	/**
+	 * Constructs a new WebSphereTransactionManagerLookup.
+	 */
 	public WebSphereTransactionManagerLookup() {
 		try {
 			Class clazz;
 			int version;
 			try {
-				clazz = Class.forName("com.ibm.ws.Transaction.TransactionManagerFactory");
+				clazz = Class.forName( "com.ibm.ws.Transaction.TransactionManagerFactory" );
 				version = 5;
-				log.info("WebSphere 5.1");
+				log.info( "WebSphere 5.1" );
 			}
-			catch (Exception e) {
+			catch ( Exception e ) {
 				try {
-					clazz = Class.forName("com.ibm.ejs.jts.jta.TransactionManagerFactory");
+					clazz = Class.forName( "com.ibm.ejs.jts.jta.TransactionManagerFactory" );
 					version = 5;
-					log.info("WebSphere 5.0");
+					log.info( "WebSphere 5.0" );
 				} 
-				catch (Exception e2) {
-					clazz = Class.forName("com.ibm.ejs.jts.jta.JTSXA");
+				catch ( Exception e2 ) {
+					clazz = Class.forName( "com.ibm.ejs.jts.jta.JTSXA" );
 					version = 4;
-					log.info("WebSphere 4");
+					log.info( "WebSphere 4" );
 				}
 			}
 
-			tmfClass=clazz;
-			wsVersion=version;
+			tmfClass = clazz;
+			wsVersion = version;
 		}
-		catch (Exception e) {
+		catch ( Exception e ) {
 			throw new HibernateException( "Could not obtain WebSphere TransactionManagerFactory instance", e );
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public TransactionManager getTransactionManager(Properties props) throws HibernateException {
 		try {
-			return (TransactionManager) tmfClass.getMethod("getTransactionManager", null).invoke(null, null);
+			return ( TransactionManager ) tmfClass.getMethod( "getTransactionManager", null ).invoke( null, null );
 		}
-		catch (Exception e) {
+		catch ( Exception e ) {
 			throw new HibernateException( "Could not obtain WebSphere TransactionManager", e );
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	public String getUserTransactionName() {
-		return wsVersion==5 ?
-			"java:comp/UserTransaction":
-			"jta/usertransaction";
+		return wsVersion == 5
+				? "java:comp/UserTransaction"
+				: "jta/usertransaction";
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
+	public Object getTransactionIdentifier(Transaction transaction) {
+		return transaction;
+	}
 }
\ No newline at end of file




More information about the hibernate-commits mailing list