`

处理懒加载问题后出现的问题:Write operations are not allowed in read-only mode (FlushMode.NEVE

    博客分类:
  • java
 
阅读更多

进行懒加载处理后增加数据出现的问题: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。

Web.xml配置如下:

<filter> 
    <filter-name>hibernateFilter</filter-name> 
    <filter-class> 
        org.springframework.orm.hibernate3.support.OpenSessionInViewFilter 
    </filter-class> 
     <init-param> 
        <param-name>singleSession</param-name> 
        <param-value>false</param-value> 
    </init-param> 
</filter> 
<filter-mapping> 
    <filter-name>hibernateFilter</filter-name> 
    <url-pattern>/*</url-pattern> 
</filter-mapping> 

 

出现上面的情况是因为之前Web.xml中没有这个

<init-param> 
        <param-name>singleSession</param-name> 
        <param-value>false</param-value> 
 </init-param>

 

 

或者是把false设置为true:

<init-param> 
        <param-name>singleSession</param-name> 
        <param-value>true</param-value> 
 </init-param>

分享到:
评论

相关推荐

    使用Spring引起的错误

    ### 使用Spring引起的错误:Write ...通过以上解决方案和配置示例,可以有效地解决在使用Spring框架和Hibernate时出现的“Write operations are not allowed in read-only mode (FlushMode.NEVER)”这一问题。

    cors-filter-1.7.jar,cors-filter-2.5.jar,cors-filter-2.10.jar

    Tomcat作为一款广泛使用的Java Web服务器,提供了一种方式来处理跨域请求,这就是我们今天要讨论的“cors-filter”jar包。 标题中的“cors-filter-1.7.jar”,“cors-filter-2.5.jar”和“cors-filter-2.10.jar”是...

    Tomcat解决跨域的两个jar包java-property-utils-1.9.jar和cors-filter-1.7.jar

    在开发Web应用时,跨域问题常常困扰着开发者。跨域是由于浏览器的同源策略(Same-Origin Policy)限制,导致不同源的请求无法互相访问。然而,随着现代Web服务的发展,API接口的广泛使用,跨域问题变得越来越普遍。...

    cors-filter-1.7.jar,java-property-utils-1.9.jar

    总结来说,"cors-filter-1.7.jar"和"java-property-utils-1.9.jar"在Geoserver的CORS跨域资源访问配置中起到关键作用,前者处理跨域请求,后者则为配置提供便利。了解这些知识点对于构建高效、安全的跨域Web应用至关...

    cors-filter-1.7.jar spring解决跨域问题 java

    Spring框架提供了灵活的解决方案来处理跨域请求。本篇将详细讲解如何利用Spring解决跨域问题,以及如何使用`cors-filter-1.7.jar`和`java-property-utils-1.9.1.jar`这两个库来辅助实现。 一、Spring解决跨域问题的...

    解决Tomcat跨域的jar包,java-property-utils-1.9.jar

    这里提到的`java-property-utils-1.9.jar`并不是直接解决跨域问题的库,但它可能在配置或辅助处理跨域问题的过程中起到一定作用,因为它是一个Java属性处理工具包。 `java-property-utils`这个库主要用来处理Java的...

    HTTP错误大全

    **405 Method Not Allowed** - 请求行中指定的方法不被允许使用于请求相应的资源。 **406 Not Acceptable** - 服务器生成的响应没有满足客户端的MIME类型需求。 **407 Proxy Authentication Required** - 和401...

    springmodules-cache.xsd&springmodules-ehcache.xsd.rar

    xml/ns/javaee":deferred-syntax-allowed-as-literal, "http://java.sun.com/xml/ns/javaee":trim-directive-whitespaces, "http://java.sun.com/xml/ns/javaee":default-content-type, ...

    QT 下载:Download from your IP address is not allowed

    Download from your IP address is not allowed 百度网盘永久连接: QT下载: qt-opensource-linux-x64-5.8.0.run: 链接:https://pan.baidu.com/s/1sQ3tqPaWdDnmhBYAc_XR7g qt-opensource-linux-x64-5.13.1....

    webgoat-standalone-7.1-SNAPSHOT-exec.jar

    Prerequisites: Java VM 1.8 Open a command shell/window, browse to where you ...Using the --help option will show the allowed command line arguments. 更多查看: https://github.com/WebGoat/WebGoat

    PyPI 官网下载 | aws-cdk.aws-cloudfront-origins-1.97.0.tar.gz

    "allowed_methods": cloudfront.AllowedMethods.ALLOW_ALL, "cached_methods": cloudfront.CachedMethods.CACHE_GET_HEAD_OPTIONS, "default_ttl": core.Duration.minutes(5), }, ) ``` 在上面的例子中,我们...

    nrpe-2.15.tar.gz

    4. **警报通知** - 当系统出现异常时,能发送邮件、短信或通过其他方式通知管理员。 **NRPE扩展功能:** 1. **远程执行插件** - NRPE允许Nagios服务器在远程主机上运行插件,获取更丰富的监控数据。 2. **安全性...

    net55-r8168-8.045a-napi.x86_64.rar

    2015-01-16: Version 8.039.01: Changed driver code to not use IP checksum hardware offload (caused various issues with networking in VMs) 2015-01-05: Version 8.039.00: Original version

    net51-r8169-6.011.00-2vft.510.0.0.799733.x86_64.rar

    在线封装和离线封装驱动 ... Description ...Adds the blacklisted ESXi 5.1 built-in ...Requires MaintMode Live Install Allowed Live Remove Allowed Stateless Ready Overlay Yes No No Yes No

    sciter-sdk-4.0.0.7

    NOTE: Windows executables in SDK are not signed so you may encounter security warnings on W8 and W10. On MacOS you may need to run SDK executables directly from console as they are not signed too.

    net-e1000e-3.1.0.2-glr2.x86_64.rar

    Requires MaintMode Live Install Allowed Live Remove Allowed Stateless Ready Overlay Yes No No Yes No Additional links Related VMware Forum's post Package updated to include missing device IDs 1502...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    When True then in ftmPanning mode will be shown only cached image of the initial client area. All parts outside will paints of the TFlexPanel.Brush. When returning from ftmPanning mode the complete ...

    Open_Session_In_View详解.doc

    org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly' marker ...

    ZK 6.5.0 Configuration Reference

    - **processing-prompt-delay Element**: 设置处理提示出现的延迟时间。 - **resend-delay Element**: 控制重发 AJAX 请求之前的等待时间。 - **tooltip-delay Element**: 设置工具提示显示的延迟时间。 - **desktop...

    hibernate错误解决方案

    org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly' marker ...

Global site tag (gtag.js) - Google Analytics