KickJava   Java API By Example, From Geeks To Geeks.

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


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 JOnAS
11  * @author ?
12  */

13 public class JOnASTransactionManagerLookup 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.jonas_tm.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 JOnAS transaction manager instance", e );
25         }
26     }
27
28     public String JavaDoc getUserTransactionName() {
29         return "java:comp/UserTransaction";
30     }
31
32 }
33
34
Popular Tags