当前位置: 代码迷 >> Java Web开发 >> spring+hibernate更新有关问题
  详细解决方案

spring+hibernate更新有关问题

热度:109   发布时间:2016-04-17 13:51:55.0
spring+hibernate更新问题
<bean   id= "txManager "
class= "org.springframework.orm.hibernate3.HibernateTransactionManager ">
<property   name= "sessionFactory "   ref= "sessionFactory "> </property>
</bean>
<aop:config>
                  <aop:pointcut   id= "defaultDaoOperation "
        expression= "execution(*   com.test.*.dao.*(..)) "   />
                  <aop:advisor   advice-ref= "defaultTxAdvice "
        pointcut-ref= "defaultDaoOperation "   />
</aop:config>
<tx:advice   id= "defaultTxAdvice "   transaction-manager= "txManager ">
<tx:attributes>
<tx:method   name= "* "/>
</tx:attributes>
</tx:advice>

无论是更新还是保存都出现下弥漫的错误:
org.springframework.dao.InvalidDataAccessApiUsageException:   Write   operations   are   not   allowed   in   read-only   mode   (FlushMode.NEVER/MANUAL):   Turn   your   Session   into   FlushMode.COMMIT/AUTO   or   remove   'readOnly '   marker   from   transaction   definition.


------解决方案--------------------
  相关解决方案