当然支持回滚!  不然怎么叫做事务呢?!  出现异常,就会回滚数据库操作。
    还可以设计成 针对某些异常回滚事务。  SPring事务,是使用AOP拦截技术实现的!

解决方案 »

  1.   

    spring只需要你配置好xml文件就可以使用spring的事务管理了。可以参考以下代码:
    <bean id="userDAOProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
      <property name="transactionManager">
       <ref bean="transactionManager" />
      </property>
      <property name="target">
       <ref local="userDAO" /><!--这个bean有数据库的操作-->
      </property>
      <property name="transactionAttributes">
       <props>
        <prop key="insert*">PROPAGATION_REQUIRED</prop>
        <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
        <prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
       </props>
      </property>
     </bean>
    通过上面配置,spring就会对userDAO进行事务管理。