JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java Application Framework » Spring  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 spring事务问题2
Neil_Dang





發文: 66
積分: 0
於 2007-06-15 19:35 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我用的是spring2.0,为什么配置1事务不起作用,而配置2和3能起作用
配置1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<bean id="commonServiceProxy"
    class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    <property name="transactionManager" ref="txManager" />
    <property name="proxyInterfaces">
      <list>
      <value>net.neil.test1.service.ICommonService</value>
      </list>
      </property>
      <property name="target" ref="commonService" />
    
    <property name="transactionAttributes">
      <props>
        <prop key="save">PROPAGATION_REQUIRED</prop>
      </props>
    </property>
  </bean>

配置2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<bean id="commonServiceInterceptor"
    class="org.springframework.transaction.interceptor.TransactionInterceptor">
    <property name="transactionManager" ref="txManager" />
    <property name="transactionAttributes">
      <props>
        <prop key="save">PROPAGATION_REQUIRED</prop>
      </props>
    </property>
  </bean>
 
  <bean
    class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
    <property name="beanNames">
      <list>
        <value>commonService</value>
      </list>
    </property>
    <property name="interceptorNames">
      <list>
        <value>commonServiceInterceptor</value>
      </list>
    </property>
  </bean>

配置3
1
2
3
4
5
6
7
8
9
10
<tx:advice id="txAdvice" transaction-manager="txManager">
    <tx:attributes>
    <tx:method name="save" propagation="REQUIRED"/>
    </tx:attributes>
    </tx:advice>
    
<aop:config>
    <aop:pointcut id="commonSerivePointcut" expression="execution (* net.neil.test1.service.ICommonService.*(..))" />
    <aop:advisor advice-ref="txAdvice" pointcut-ref="commonSerivePointcut"/>
</aop:config>


reply to postreply to post
心比天高,命比紙薄~
» JWorld@TW »  Java Application Framework » Spring

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8