我刚开始也想传个LIST,然后循环执行删除或修改语句,但是事务能否得了控制。

解决方案 »

  1.   

    事务是否控制,要看你的spring是怎么配的了
      

  2.   

    对啊,你spring对你的dao是怎么配置事物的。
      

  3.   

    <bean id="userRoleImpl" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> 
    <property name="transactionManager"> 
    <ref bean="transactionManager" /> 
    </property> 

    <!-- 源于spring-struts.xml-->
    <property name="target"> 
    <ref local="userRoleTarget" /> 
    </property> 

    <property name="proxyTargetClass"> 
    <value>true</value> 
    </property> 

    <property name="transactionAttributes"> 
    <props> 
    <prop key="save*">PROPAGATION_REQUIRED</prop> 
    <prop key="remove*">PROPAGATION_REQUIRED,readOnly</prop> 
    <prop key="*">PROPAGATION_REQUIRED</prop> 
    </props> 
    </property> 
    </bean>
      

  4.   

    前面贴的不清晰,看下面的
    <bean id="userRoleDao" class="com.yims.dao.hibernate.UserRoleDaoHibernate"> 
    <property name="sessionFactory"> 
    <ref local="sessionFactory" /> 
    </property> 
    </bean> <bean id="userRoleTarget" class="com.yims.service.impl.UserRoleImpl"> 
    <property name="userRoleDao"> 
    <ref local="userRoleDao" /> 
    </property> 
    </bean> <bean id="userRoleImpl"  class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> 
    <property name="transactionManager"> 
    <ref bean="transactionManager" /> 
    </property> 

    <property name="target"> 
    <ref local="userRoleTarget" /> 
    </property> 

    <property name="proxyTargetClass"> 
    <value>true</value> 
    </property> 

    <property name="transactionAttributes"> 
    <props> 
    <prop key="save*">PROPAGATION_REQUIRED</prop> 
             <prop key="remove*">PROPAGATION_REQUIRED,readOnly</prop> 
    <prop key="*">PROPAGATION_REQUIRED</prop> 
    </props> 
    </property> 
    </bean>