Spring声明式事务异常不回滚的问题
Spring声明式事务异常不回滚的问题,详细描述如下:请大家帮忙看看
spring相关配置如下:
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<!-- base dao begin -->
<bean id="baseDao" class="com.cube.baseprj.dao.BaseDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<bean id="transactionBase"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
lazy-init="true" abstract="true">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED,-DataAccessException</prop>
</props>
</property>
</bean>
<bean id="empServiceDAOProxy" parent="transactionBase" >
<property name="target">
<ref bean="empService" />
</property>
</bean>
<bean id="empService" class="com.cube.baseprj.service.employee.EmployeeServiceImpl" singleton="false">
<property name="dao" ref="baseDao" />
</bean>
EmployeeServiceImpl的saveEmp方法如下
public void saveEmp(Tuser user,Temployee employee){
dao.save(user);
dao.save(employee);
}
其中employee对象的数据在插入数据库时会出错,因为设置了一个过长的字段,但是执行时抛出异常,user照样保存了
请大家帮忙看看问题在哪?