Yesterday found that the normal function of an error, errors log as follows:
Error log: Hibernate:select taxtypecon0_.id as Id62_, taxtypecon0_. Tax_type_name as Tax2_62_, taxtypecon0_. EXPRESSIONS as Expressi3_62_, taxtypecon0_. Create_date as Create4_62_, taxtypecon0_. Created_by as Created5_62_, taxtypecon0_. Last_update_date as Last6_62_, taxtypecon0_. Last_updated_by as Last7_62_, Taxtypecon0_.type_kind as Type8_62_, taxtypecon0_. Valid_date_start as Valid9_62_, taxtypecon0_. Valid_date_end as Valid10_62_, taxtypecon0_.is_valid as is11_62_ from Tb_taxtype_config taxtypecon0_ where (taxtypecon0_ . type_kind=1) Order by taxtypecon0_. Create_date desc hibernate:select taxtypecon0_.id as id62_, taxtypecon0_. Tax_type_name as Tax2_62_, taxtypecon0_. EXPRESSIONS as Expressi3_62_, taxtypecon0_. Create_date as Create4_62_, taxtypecon0_. Created_by as Created5_62_, taxtypecon0_. Last_update_date as Last6_62_, taxtypecon0_. Last_updated_by as Last7_62_, Taxtypecon0_.type_kind as Type8_62_, taxtypecon0_. Valid_date_start as Valid9_62_, taxtypecon0_. Valid_date_end as Valid10_62_, TaxtypeCon0_.is_valid as is11_62_ from Tb_taxtype_config taxtypecon0_ where (taxtypecon0_.id=101) Org.springframework.dao.InvalidDataAccessApiUsageException:Write operations are not allowed in read-only mode ( flushmode.never/manual): Turn your session to Flushmode.commit/auto or remove ' readOnly ' marker from transaction definit
Ion.
At org.springframework.orm.hibernate3.HibernateTemplate.checkWriteOperationAllowed (hibernatetemplate.java:1186) At Org.springframework.orm.hibernate3.hibernatetemplate$16.doinhibernate (hibernatetemplate.java:750) at Org.springframework.orm.hibernate3.HibernateTemplate.doExecute (hibernatetemplate.java:419) at Org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession (hibernatetemplate.java:374) at Org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate (hibernatetemplate.java:748) at Com.linkage.framework.pub.dao.BaseDao.saveOrUpdate (basedao.java:65) at Com.linkage.budgetNew.cform.dao.impl.TaxtypeConfigDaoIMpl.savetaxtype (taxtypeconfigdaoimpl.java:33) at Com.linkage.budgetNew.cform.service.impl.TaxtypeConfigServiceImpl.saveTaxtype (taxtypeconfigserviceimpl.java:24 ) at com.linkage.budgetnew.cform.service.impl.taxtypeconfigserviceimpl$ $FastClassByCGLIB $$766ec933.invoke (< generated>) at Net.sf.cglib.proxy.MethodProxy.invoke (methodproxy.java:191) at Org.springframework.aop.framework . Cglib2aopproxy$cglibmethodinvocation.invokejoinpoint (cglib2aopproxy.java:700) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (reflectivemethodinvocation.java:149) at Org.springframework.transaction.interceptor.TransactionInterceptor.invoke (transactioninterceptor.java:106) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (reflectivemethodinvocation.java:171) at Org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke (exposeinvocationinterceptor.java:89) at Org.springframework.aop.framework.ReflectiveMethodInvocation. Proceed (reflectivemethodinvocation.java:171) at org.springframework.aop.framework.cglib2aopproxy$ Dynamicadvisedinterceptor.intercept (cglib2aopproxy.java:635) at com.linkage.budgetnew.cform.service.impl.taxtypeconfigserviceimpl$ $EnhancerByCGLIB $ $aa 2803a3.savetaxtype (< generated>) at Com.linkage.budgetNew.cform.action.TaxTypeConfigAction.saveTaxType (taxtypeconfigaction.java:53
)
Debug Debug Discovery called Saveorupdate () method in DAO layer wrong times
public void Savetaxtype (Taxtypeconfig taxtypeconfig)
{
Saveorupdate (Taxtypeconfig);
}
The comparison log says:
Org.springframework.dao.InvalidDataAccessApiUsageException:Write operations are not allowed in read-only mode ( flushmode.never/manual): Turn your session to
Flushmode.commit/auto or remove ' readOnly ' marker from Transaction de Finition.
Know is configured hibernate transaction management has a problem, really found that the following line was mistakenly deleted, plus this sentence is OK.
<tx:method name= "save*" rollback-for= "Exception" propagation= "REQUIRED"/>
Without this line, transaction management defaults to the bottom
<tx:method name= "*" propagation= "SUPPORTS" read-only= "true"/>
This makes it impossible to write:
Write operations are not allowed in read-only mode (flushmode.never/manual)
<!--transaction management-->
<tx:advice id= "TxAdvice2" transaction-manager= "TransactionManager" >
<tx: attributes>
<tx:method name= "do*" propagation= "REQUIRED" rollback-for= "Exception"/> <tx
: Method Name= "add*" propagation= "REQUIRED" rollback-for= "Exception"/> <tx:method name=
"save*" rollback-for = "Exception" propagation= "REQUIRED/> <tx:method name=" del* "propagation=" REQUIRED "
rollback-for=" Exception "/> <tx:method name=" mod* propagation= "REQUIRED" rollback-for= "Exception"/> <tx
: Method Name= "ins*" propagation= "REQUIRED rollback-for=" Exception "/> <tx:method name=" upd* "propagation="
REQUIRED "rollback-for=" Exception "/>
<tx:method name=" invoke "propagation=" Requires_new "rollback-for=" Exception "/>
<tx:method name=" * "propagation=" SUPPORTS "read-only=" true "/>
>
</tx:advice>