An error occurred while executing a method Bumenauth () in the service:
Org.springframework.dao.InvalidDataAccessApiUsageException:Write operations is not allowed in read-only mode ( Flushmode.never)-Turn your Session to Flushmode.auto or remove ' readOnly ' marker from transaction definition
To view the transaction management configuration in srping:
<bean id= "Txproxytemplate" abstract= "true"
class= "Org.springframework.transaction.interceptor.TransactionProxyFactoryBean" >
<property name= "TransactionManager" >
<ref bean= "TransactionManager"/>
</property>
<property name= "Transactionattributes" >
<props>
<prop key= "find*" >PROPAGATION_REQUIRED</prop>
<prop key= "save*" >PROPAGATION_REQUIRED</prop>
<prop key= "remove*" >PROPAGATION_REQUIRED</prop>
<prop key= "update*" >PROPAGATION_REQUIRED</prop>
<prop key= "create*" >PROPAGATION_REQUIRED</prop>
<prop key= "add*" >PROPAGATION_REQUIRED</prop>
<prop key= "del*" >PROPAGATION_REQUIRED</prop>
<prop key= "clear*" >PROPAGATION_REQUIRED</prop>
<prop key= "build*" >PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
After looking at the original transaction strategy <prop key= "*" >PROPAGATION_REQUIRED</prop> was deleted after the Bumenauth () method after forgetting to modify, so that caused the error reported above
Modify method One:
Modify this method to update or Build,add .... Methods such as the beginning of the above policy name: Updatebumenauth ()
Modify method Two:
Add <prop key= "*" >PROPAGATION_REQUIRED</prop> can
Modify method Three:
Add Web. XML under the
<filter>
<filter-name>OpenSessionInViewFilter</filter-name>
<filter-class>
Org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</filter-class>
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
</filter>
The singlesession value in is modified to false, that is, does not restrict the entire process with the same session, but the disadvantage is that Hibernate session instance may be greatly increased, the use of the JDBC Connection amount will be greatly increased, If the maxpoolsize of connection pool is too small, it's easy to go wrong.
Reference: About Opensessionview (http://liuwei1578.blog.163.com/blog/static/4958036420092104215514/)
Spring Transaction Configuration Transactionproxyfactorybean (http://liuwei1578.blog.163.com/blog/static/49580364200921041136625/)