1 | public class BTMTransactionManagerLookup implements TransactionManagerLookup {↵ | | 1 | public class JOnASTransactionManagerLookup implements TransactionManagerLookup {↵
|
2 |
↵ | | |
|
|
3 | /**
↵ | | 2 | /**↵
|
4 | * {@inheritDoc}
↵ | | 3 | * @see org.hibernate.transaction.TransactionManagerLookup#getTransactionManager(Properties)↵
|
5 | */
↵ | | 4 | */↵
|
6 | public TransactionManager getTransactionManager(Properties props) throws HibernateException {
↵ | | 5 | public TransactionManager getTransactionManager(Properties props) throws HibernateException {↵
|
7 | try {
↵ | | 6 | try {↵
|
8 | Class clazz = Class.forName("bitronix.tm.TransactionManagerServices");
↵ | | 7 | Class clazz = Class.forName("org.objectweb.jonas_tm.Current");↵
|
9 | return (TransactionManager) clazz.getMethod("getTransactionManager", null).invoke(null, null);
↵ | | 8 | return (TransactionManager) clazz.getMethod("getTransactionManager", null).invoke(null, null);↵
|
10 | }
↵ | | 9 | }↵
|
11 | catch (Exception e) {
↵ | | 10 | catch (Exception e) {↵
|
12 | throw new HibernateException( "Could not obtain BTM transaction manager instance", e );
↵ | | 11 | throw new HibernateException( "Could not obtain JOnAS transaction manager instance", e );↵
|
13 | }
↵ | | 12 | }↵
|
14 | }↵ | | 13 | }↵
|
15 |
↵ | | |
|
|
16 | /**
↵ | | 14 | /**↵
|
17 | * {@inheritDoc}
↵ | | 15 | * {@inheritDoc}↵
|
18 | */
↵ | | 16 | */↵
|
19 | public String getUserTransactionName() {
↵ | | 17 | public String getUserTransactionName() {↵
|
20 | return "java:comp/UserTransaction";
↵ | | 18 | return "java:comp/UserTransaction";↵
|
21 | }↵ | | 19 | }↵
|
22 |
↵ | | |
|
|
23 | /**
↵ | | 20 | /**↵
|
24 | * {@inheritDoc}
↵ | | 21 | * {@inheritDoc}↵
|
25 | */
↵ | | 22 | */↵
|
26 | public Object getTransactionIdentifier(Transaction transaction) {
↵ | | 23 | public Object getTransactionIdentifier(Transaction transaction) {↵
|
27 | return transaction | | 24 | return transaction
|