FileDocCategorySizeDatePackage
WebSphereTransactionManagerLookup.javaAPI DocHibernate 3.2.51851Wed Oct 26 17:03:04 BST 2005org.hibernate.transaction

WebSphereTransactionManagerLookup

public class WebSphereTransactionManagerLookup extends Object implements TransactionManagerLookup
TransactionManager lookup strategy for WebSphere (versions 4, 5.0 and 5.1)
author
Gavin King

Fields Summary
private static final Log
log
private final int
wsVersion
private final Class
tmfClass
Constructors Summary
public WebSphereTransactionManagerLookup()

	
	  
		try {
			Class clazz;
			int version;
			try {
				clazz = Class.forName("com.ibm.ws.Transaction.TransactionManagerFactory");
				version = 5;
				log.info("WebSphere 5.1");
			}
			catch (Exception e) {
				try {
					clazz = Class.forName("com.ibm.ejs.jts.jta.TransactionManagerFactory");
					version = 5;
					log.info("WebSphere 5.0");
				} 
				catch (Exception e2) {
					clazz = Class.forName("com.ibm.ejs.jts.jta.JTSXA");
					version = 4;
					log.info("WebSphere 4");
				}
			}

			tmfClass=clazz;
			wsVersion=version;
		}
		catch (Exception e) {
			throw new HibernateException( "Could not obtain WebSphere TransactionManagerFactory instance", e );
		}
	
Methods Summary
public javax.transaction.TransactionManagergetTransactionManager(java.util.Properties props)

		try {
			return (TransactionManager) tmfClass.getMethod("getTransactionManager", null).invoke(null, null);
		}
		catch (Exception e) {
			throw new HibernateException( "Could not obtain WebSphere TransactionManager", e );
		}
	
public java.lang.StringgetUserTransactionName()

		return wsVersion==5 ?
			"java:comp/UserTransaction":
			"jta/usertransaction";