Connection is read-only. Queries leading to data modification are not allowed
<tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes>
<tx:method name="*" propagation="REQUIRED" read-only="true" />
<tx:method name="add*" propagation="REQUIRED" /> <tx:method name="del*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="save*" propagation="REQUIRED" /> <tx:method name="create*" propagation="REQUIRED" /> <tx:method name="clear*" propagation="REQUIRED" /> </tx:attributes> </tx:advice>
<tx:method name="*" propagation="REQUIRED" read-only="true" />
<pre name="code" class="html"><context:component-scan base-package="com.eq3z" /> <!-- 配置事务管理器 --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- 配置事务传播特性 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="save*" propagation="REQUIRED"/> <tx:method name="update*" propagation="REQUIRED"/> <tx:method name="delete*" propagation="REQUIRED"/> <tx:method name="*" read-only="true"/> </tx:attributes> </tx:advice> <!-- 定义使用事务管理的方法 --> <aop:config> <aop:pointcut id="managerMethod" expression="execution(* com.service.*.*(..))"/> <aop:advisor pointcut-ref="managerMethod" advice-ref="txAdvice"/> </aop:config>
Connection is read-only. Queries leading to data modification are not allowed,布布扣,bubuko.com
Connection is read-only. Queries leading to data modification are not allowed
原文地址:http://blog.csdn.net/u011067360/article/details/38498981