日期:2014-05-18  浏览次数:20704 次

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.


------解决方案--------------------