why cann't rollback ? this Thansaction?
Code:<bean id="silverSessionFactory" class="com.bjhuajia.silver.dao.SilverSessionFactory" factory-method="getDataSource"> </bean> <bean id="transMan" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource"><ref local="silverSessionFactory"/></property> </bean> <bean id="actionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" > <property name="transactionManager"> <ref bean="transMan"/> </property> <property name="target"> <ref local="action" /> </property> <property name="transactionAttributes"> <props> <prop key="exe*">PROPAGATION_REQUIRED,-BaseException</prop> </props> </property> <property name="proxyInterfaces"><value>com.bjhuajia.silver.control.I_Action</value></property> </bean>
Code:package com.bjhuajia.silver.dao; import java.sql.Connection; import javax.sql.DataSource; import org.springframework.jdbc.datasource.DataSourceUtils; public class SilverSessionFactory { //private static Logger logger = // Logger.getLogger(HibernateSessionFactory.class); public static final ThreadLocal tl = new ThreadLocal(); public static DataSource getDataSource() { if (tl.get() == null) { tl.set(DataSourceUtils.getDataSourceFromJndi("jdbc/silver")); return (DataSource) tl.get(); } else return (DataSource) tl.get(); } public static Connection getConnect() { return DataSourceUtils.getConnection(getDataSource()); } public static void closeConn() { DataSourceUtils.closeConnectionIfNecessary(getConnect(), getDataSource()); tl.set(null); } }
does DataSourceUtils use same connection?


Reply With Quote