FileDocCategorySizeDatePackage
TransactionFactoryFactory.javaAPI DocHibernate 3.2.51904Thu Aug 12 09:50:06 BST 2004org.hibernate.transaction

TransactionFactoryFactory

public final class TransactionFactoryFactory extends Object
author
Gavin King

Fields Summary
private static final Log
log
Constructors Summary
private TransactionFactoryFactory()

Methods Summary
public static TransactionFactorybuildTransactionFactory(java.util.Properties transactionProps)
Obtain a TransactionFactory with the transaction handling strategy specified by the given Properties.

param
transactionProps transaction properties
return
TransactionFactory
throws
HibernateException


	                     	 
	       

		String strategyClassName = transactionProps.getProperty(Environment.TRANSACTION_STRATEGY);
		if (strategyClassName==null) {
			log.info("Using default transaction strategy (direct JDBC transactions)");
			return new JDBCTransactionFactory();
		}
		log.info("Transaction strategy: " + strategyClassName);
		TransactionFactory factory;
		try {
			factory = (TransactionFactory) ReflectHelper.classForName(strategyClassName).newInstance();
		}
		catch (ClassNotFoundException e) {
			log.error("TransactionFactory class not found", e);
			throw new HibernateException("TransactionFactory class not found: " + strategyClassName);
		}
		catch (IllegalAccessException e) {
			log.error("Failed to instantiate TransactionFactory", e);
			throw new HibernateException("Failed to instantiate TransactionFactory: " + e);
		}
		catch (java.lang.InstantiationException e) {
			log.error("Failed to instantiate TransactionFactory", e);
			throw new HibernateException("Failed to instantiate TransactionFactory: " + e);
		}
		factory.configure(transactionProps);
		return factory;