`
waw
  • 浏览: 23669 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

Connection is read-only. Queries leading to data modification are not allowed

阅读更多

Connection is read-only. Queries leading to data modification are not allowed

 

1.检查事务配置

2.检查方法命名

 

检查在诸如 loadXXXX, queryXXX 的查询方法中,是否用了update,insert ,delete 数据的操作!

 

我的出错的地方是 方法名是 :loadXXXOrAddXXX()

 

事务配置xml如下

 

<tx:advice id="txAdvice" transaction-manager="transactionManager">
        <tx:attributes>
            <tx:method name="load*" read-only="true" />
            <tx:method name="find*" read-only="true" />
            <tx:method name="query*" read-only="true" />
            <tx:method name="select*" read-only="true" />
            <tx:method name="validate*" read-only="true" />
           
            <tx:method name="add*" propagation="REQUIRED"/>
            <tx:method name="insert*" propagation="REQUIRED"/>
            <tx:method name="create*" propagation="REQUIRED"/>
            <tx:method name="save*" propagation="REQUIRED"/>
            <tx:method name="update*" propagation="REQUIRED"/>
            <tx:method name="modify*" propagation="REQUIRED"/>
            <tx:method name="delete*" propagation="REQUIRED"/>
            <tx:method name="remove*" propagation="REQUIRED"/>
            <tx:method name="do*" propagation="REQUIRED"/>
            
            <tx:method name="*" propagation="SUPPORTS"
                rollback-for="Throwable" />
        </tx:attributes>
    </tx:advice>

 

 

就是这个 <tx:method name="load*" read-only="true" /> 
 匹配了

loadXXXOrAddXXX() 这个方法名,然后connection是 readonly的,所以无法做insert的操作!

 

坑爹了!!!!

 

 

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics