1 4 5 package org.enhydra.shark.usertransaction; 6 7 import org.enhydra.shark.api.RootException; 8 import org.enhydra.shark.api.TransactionException; 9 import org.enhydra.shark.api.UserTransaction; 10 import org.enhydra.shark.api.internal.usertransaction.UserTransactionFactory; 11 import org.enhydra.shark.api.internal.working.CallbackUtilities; 12 13 18 public class HibernateUserTransactionFactory implements UserTransactionFactory { 19 static boolean _debug_ = false; 20 21 private static final String DBG_PARAM_NAME = "HibernateUserTransactionFactory.debug"; 22 public void configure (CallbackUtilities cus) throws RootException { 23 if (null == cus) 24 throw new RootException("Cannot configure without call back impl."); 25 _debug_ = Boolean 26 .valueOf(cus.getProperty(DBG_PARAM_NAME, "false")) 27 .booleanValue(); 28 } 29 30 public UserTransaction createTransaction () throws TransactionException { 31 try { 32 return new SharkHibernateUserTransaction(ThreadLocalSession.currentSession().beginTransaction()); 33 } catch (Exception ex) { 34 throw new TransactionException(ex); 35 } 36 } 37 38 } 39 40 | Popular Tags |