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

» JWorld@TW » Java Application Framework » Spring  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to postflat modego to previous topicgo to next topic
本主題所含的標籤
作者 請教有關TransactionManager的commit
uxa





發文: 489
積分: 6
於 2009-02-25 11:49 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
請教一下小弟在某一個method中當有Exception發生時要做commit
將其設定為PROPAGATION_REQUIRED, +java.lang.Exception
但是當我在執行時遇到Exeption後spring卻丟出以下的訊息
1
2
3
4
5
6
7
org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only
  at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:672)
  at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:357)
  at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
  at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
  at $Proxy4.paymentProc(Unknown Source)


我將DataSourceTransactionManager的log打開來看到這樣的訊息
1
2
3
4
2009-02-25 11:38:45,312 DEBUG [org.springframework.jdbc.datasource.DataSourceTransactionManager.processRollback:805]- Participating transaction failed - marking existing transaction as rollback-only
2009-02-25 11:38:45,312 DEBUG [org.springframework.jdbc.datasource.DataSourceTransactionManager.doSetRollbackOnly:286]- Setting JDBC transaction [jdbc:oracle:thin:@10.1.5.224:1521:o9idb, UserName=TEST, Oracle JDBC driver] rollback-only
2009-02-25 11:38:45,312 DEBUG [org.springframework.jdbc.datasource.DataSourceTransactionManager.commit:666]- Global transaction is marked as rollback-only but transactional code requested commit
 


請教一下是什麼情況下會將Transaction設置為rollback only呢
有其他的方式可以達到有Exception時commit嗎


reply to postreply to post
☆只要努力就有希望☆
話題樹型展開
人氣 標題 作者 字數 發文時間
3149 請教有關TransactionManager的commit uxa 1680 2009-02-25 11:49
2931 Re:請教有關TransactionManager的commit koji 41 2009-02-25 22:10
3062 Re:請教有關TransactionManager的commit uxa 149 2009-02-26 11:07
» JWorld@TW »  Java Application Framework » Spring

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

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8