今天在同事遇到一个问题,仔细看了一下,竟然是由hibernate事务引起的。
错误如下:Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO respectively remove ’readOnly’ marker from transaction definition
刚开始始终没找到头绪,从网上找了一下,都 说是事务原因,看代码只有一个简单的保存save方法。于是找到自己的hibernate配置文件,发现对于hibernate的事务配置中有这么一句话<prop key="retrieve*">PROPAGATION_REQUIRED,readOnly</prop>,因所有的事务层放在service层,结果那一家伙竟然把save方法写成retrivesave,狂晕呀,终于搞定。
错误如下:Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO respectively remove ’readOnly’ marker from transaction definition
刚开始始终没找到头绪,从网上找了一下,都 说是事务原因,看代码只有一个简单的保存save方法。于是找到自己的hibernate配置文件,发现对于hibernate的事务配置中有这么一句话<prop key="retrieve*">PROPAGATION_REQUIRED,readOnly</prop>,因所有的事务层放在service层,结果那一家伙竟然把save方法写成retrivesave,狂晕呀,终于搞定。