1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.hibernate.transaction;
17
18 import java.util.Properties;
19
20 import javax.transaction.TransactionManager;
21 import javax.transaction.Transaction;
22
23 import org.hibernate.HibernateException;
24
25
26
27
28
29
30 public class BTMTransactionManagerLookup implements TransactionManagerLookup {
31
32
33
34
35 public TransactionManager getTransactionManager(Properties props) throws HibernateException {
36 try {
37 Class clazz = Class.forName("bitronix.tm.TransactionManagerServices");
38 return (TransactionManager) clazz.getMethod("getTransactionManager", null).invoke(null, null);
39 }
40 catch (Exception e) {
41 throw new HibernateException( "Could not obtain BTM transaction manager instance", e );
42 }
43 }
44
45
46
47
48 public String getUserTransactionName() {
49 return "java:comp/UserTransaction";
50 }
51
52
53
54
55 public Object getTransactionIdentifier(Transaction transaction) {
56 return transaction;
57 }
58 }