1 25 package org.objectweb.easybeans.tests.common.helper; 26 27 import javax.naming.Context ; 28 import javax.naming.InitialContext ; 29 import javax.naming.NamingException ; 30 import javax.transaction.UserTransaction ; 31 32 38 public final class TransactionHelper { 39 40 43 private TransactionHelper(){ 44 45 } 46 47 48 55 public static UserTransaction getInternalUserTransaction() throws NamingException { 56 System.setProperty(Context.INITIAL_CONTEXT_FACTORY, 58 "org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory"); 59 Context initialContext = new InitialContext (); 61 UserTransaction utx = (UserTransaction ) initialContext.lookup("javax.transaction.UserTransaction"); 63 return utx; 64 } 65 66 72 public static UserTransaction getUserTransaction() throws NamingException { 73 Context initialContext = new InitialContext (); 75 UserTransaction utx = (UserTransaction ) initialContext.lookup("java:comp/UserTransaction"); 77 return utx; 78 } 79 } 80 | Popular Tags |