KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > transaction > JOTMTransactionManagerLookup


1 package org.hibernate.transaction;
2
3 import java.util.Properties JavaDoc;
4
5 import javax.transaction.TransactionManager JavaDoc;
6
7 import org.hibernate.HibernateException;
8
9 /**
10  * TransactionManager lookup strategy for JOTM
11  * @author Low Heng Sin
12  */

13 public class JOTMTransactionManagerLookup implements TransactionManagerLookup {
14
15     /**
16      * @see org.hibernate.transaction.TransactionManagerLookup#getTransactionManager(Properties)
17      */

18     public TransactionManager JavaDoc getTransactionManager(Properties JavaDoc props) throws HibernateException {
19         try {
20             Class JavaDoc clazz = Class.forName("org.objectweb.jotm.Current");
21             return (TransactionManager JavaDoc) clazz.getMethod("getTransactionManager", null).invoke(null, null);
22         }
23         catch (Exception JavaDoc e) {
24             throw new HibernateException( "Could not obtain JOTM transaction manager instance", e );
25         }
26     }
27
28     public String JavaDoc getUserTransactionName() {
29         return "java:comp/UserTransaction";
30     }
31
32 }
33
34
35
36
37
38
39
Popular Tags