1 4 5 package org.enhydra.shark.utilities.hibernate; 6 7 import org.enhydra.shark.api.RootException; 8 import org.enhydra.shark.api.SharkTransaction; 9 import org.enhydra.shark.api.TransactionException; 10 import org.enhydra.shark.api.internal.transaction.TransactionFactory; 11 import org.enhydra.shark.api.internal.working.CallbackUtilities; 12 13 18 public class HibernateUtilityTransactionFactory implements TransactionFactory { 19 static boolean _debug_ = false; 20 21 private static final String DBG_PARAM_NAME = "HibernateUtilityTransactionFactory.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 SharkTransaction createTransaction () throws TransactionException { 31 try { 32 return new SharkHibernateUtilityTransaction(ThreadLocalSession.currentSession().beginTransaction()); 33 } catch (Exception ex) { 34 throw new TransactionException(ex); 35 } 36 } 37 38 } 39 40 | Popular Tags |