解决 Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from

解决 Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from  

2011-01-07 21:33:14|  分类: Hibernate |字号 订阅

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.

问题:只读模式下(FlushMode.NEVER/MANUAL)写操作不被允许:把你的Session改成FlushMode.COMMIT/AUTO或者清除事务定义中的readOnly标记。


解决方法:

web.xml配置里添加
   
    
        OpenSessionInViewFilter
       
            org.springframework.orm.hibernate3.support.OpenSessionInViewFilter

       
            sessionFactoryBeanName
            sessionFactory
       

       
            singleSession
            true
       

       
            flushMode
            AUTO
       

    

    
        OpenSessionInViewFilter
        *.do
    

你可能感兴趣的:(java开发问题)