HTTP Status 500 - Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.
添加
<init-param>
? ? ? ? <param-name> flushMode </param-name>
? ?<param-value>AUTO </param-value> ? ? ? ?
? ? ? ? </init-param>
后沒有作用
2017-12-18
可以參考這里。http://blog.csdn.net/violet_echo_0908/article/details/51084884
2017-12-18
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
在service類開頭加上這句,也行,盡管readOnly的默認值為false
2017-07-05
<!-- 定義事務管理 -->
?<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
? <property name="sessionFactory" ref="sessionFactory"/>
?</bean>
?
?<!-- 通過<tx:advice>標簽定義事務增強,并指定事務管理器 -->
?<tx:advice id="txAdvice" transaction-manager="txManager">
? <!-- 定義屬性,聲明事務規則 -->
? <tx:attributes>
?? <tx:method name="*findAll*" read-only="true"/>
?? <tx:method name="*save*" propagation="REQUIRED"/>
??? <tx:method name="*delete*" propagation="REQUIRED"/>
???? <tx:method name="*update*" propagation="REQUIRED"/>
? </tx:attributes>
?</tx:advice>
?
?<!-- 定義切面 -->
?<aop:config>
? <!-- 定義切入點 -->
? <aop:pointcut expression="execution(* com.jbit.service.*.*(..))" id="serviceMethod"/>
? <!-- 將事務增強與切入點組合 -->
? <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethod"/>
?</aop:config>
2017-07-05
需要配置事務管理器才行