spring jdbc用配置声明事务处理
本人有一个问题是对spring jdbc用配置声明事务处理:以下是我的XML(spring applicationcontext.xml)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"
value="oracle.jdbc.driver.OracleDriver">
</property>
<property name="url"
value="jdbc:oracle:thin:@192.168.1.200:1521:orajy">
</property>
<property name="username" value="db_wwsb"></property>
<property name="password" value="db_wwsb"></property>
</bean>
<!-- database 数据库相关的接口和实现类 -->
<bean id="UserDAO" class="com.dserves.dao.UserDAOImpl">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="HanterDAO" class="com.dserves.dao.HanterDAOImpl">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- end-->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref bean="dataSource" />
</property>
</bean>
<bean id="UserDAOProxy"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref local="UserDAO" />
</property>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED,-DataAccessException</prop>
<prop key="update*">PROPAGATION_REQUIRED,-DataAccessException</prop>
<prop key="delete*">PROPAGATION_REQUIRED,-DataAccessException</prop>
<prop key="*">PROPAGATION_REQUIRED,-DataAccessException</prop>
</props>
</property>
</bean>
<bean id="HanterDAOProxy"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref local="HanterDAO" />
</property>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
</beans>
--------------------------------------
以下是我的方法:
public void updateHanter(String code) throws DataAccessException {
try {
getJdbcTemplate().update(
"update DS_HASTEN set title='MMMMM' where code=?",
new Object[] { code });
getJdbcTemplate().update(
"AAAA");
} catch (DataAccessException e) {
e.printStackTrace();
}
}
但是虽然抛异常了还是这一个更新了没有实现回滚为什么??????