1 package org.hibernate.transaction; 3 4 import java.util.Properties ; 5 6 import javax.naming.NamingException ; 7 import javax.transaction.TransactionManager ; 8 9 import org.hibernate.HibernateException; 10 import org.hibernate.util.NamingHelper; 11 12 16 public abstract class JNDITransactionManagerLookup implements TransactionManagerLookup { 17 18 21 public TransactionManager getTransactionManager(Properties props) throws HibernateException { 22 try { 23 return (TransactionManager ) NamingHelper.getInitialContext(props).lookup( getName() ); 24 } 25 catch (NamingException ne) { 26 throw new HibernateException( "Could not locate TransactionManager", ne ); 27 } 28 } 29 30 protected abstract String getName(); 31 32 } 33 34 35 36 37 38 39 | Popular Tags |