`
sunxboy
  • 浏览: 2830743 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

not allowed in read-only mode (FlushMode.NEVER) 解决

阅读更多

spring 环境下做一个check*操作时,抛出异常

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.

 

后来发现,由于我在Action中调的方法名是checkXXXXX打头,而我的applicationContext.xml中的相关配置如下:

<bean id="transactionInterceptor"
		class="org.springframework.transaction.interceptor.TransactionInterceptor">
		<property name="transactionManager" ref="transactionManager" />
		<property name="transactionAttributes">
			<props>
				<prop key="query*">PROPAGATION_REQUIRED,readOnly</prop>
				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
				<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
				<prop key="view*">PROPAGATION_REQUIRED,readOnly</prop>				
				<prop key="merge*">PROPAGATION_REQUIRED,readOnly</prop>
				<prop key="check*">PROPAGATION_REQUIRED,readOnly</prop>
				<prop key="insert*">
					PROPAGATION_REQUIRED,-GenericException
				</prop>

 即check打头的操作时,是不可操作数据库的,包括更新与增加数据。

找到原因后将

<prop key="check*">PROPAGATION_REQUIRED,readOnly</prop>

 改为

<prop key="check*">PROPAGATION_REQUIRED</prop>

 后,重启服务,问题解决。

 

 

 

 

 

 

 

分享到:
评论
2 楼 hite 2009-09-14  
Google搜到你帖子的
1 楼 hite 2009-09-14  
刚刚给同事解决了个问题!

相关推荐

    使用Spring引起的错误

    使用Spring提供的Open Session In View而引起Write operations are not allowed in read-only mode (FlushMode.NEVER) 错误解决

    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

    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

    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

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

    解决web.xml中 &lt;page-encoding&gt;UTF-8&lt;/page-encoding&gt;报错。错误提示: cvc-complex-type.2.4.a: Invalid content was found starting with element 'page-encoding'. One of '{"http:// java.sun....

    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...

    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-tulip-1.1.15-1.x86_64.rar

    Requires MaintMode Live Install Allowed Live Remove Allowed Stateless Ready Overlay Yes No No Yes No Additional links VMware Communities thread about running VMware ESXi inside Hyper-V Build ...

    sciter-sdk-4.0.3.5348

    await is allowed to be in async function() only, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function yield is allowed to be in function*() only, see: ...

    开源项目-pawelad-just-scored.zip

    开源项目-pawelad-just-scored.zip,为世界杯球迷提供lambda动力的Slack应用程序

    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 ...

    开源项目-averagesecurityguy-spf.zip

    开源项目-averagesecurityguy-spf.zip,Parse SPF records. Check for allowed clients.

    NIST SP800-76-2.pdf

    This document contains technical specifications for biometric data mandated or allowed in [FIPS]. These specifications reflect the design goals of interoperability, performance and security of the PIV...

    [麻省理工学院-算法导论].Introduction.to.Algorithms,.Second.Edition

    An algorithm whose behavior is determined not only by its input but by the values produced by a random-number generator is a randomized algorithm. We can use randomized algorithms to enforce a ...

    Lesson-1-master.zip

    3. Define and implement types of debugging allowed with EDK II 4. Identify the responsibilities of the Security phase 5. Define PEI and its purpose, functions, attributes, and components 6. Describe ...

    wp-o-matic.1.0RC4.zip

    Use the post template feature -located in campaign settings-. For example: {content} &lt;p&gt;&lt;a &gt;Link to the original site&lt;/a&gt;&lt;/p&gt; = Why isn’t the full article showing? = Because the feed you're using ...

    thymeleaf-extras-springsecurity-3.0-master.zip

    In fact, you are allowed to surround your access expression with ${...} if it makes you feel more comfortable: ${hasRole(#vars.expectedRole)}"&gt; This will only be displayed if authenticated user ...

    NR5G网络拒绝码-5gmm_cause = 27 (0x1b) (N1 mode not allowed).docx

    从3GPP协议和UE端行为分析5G gmm cause #27的网络问题

    FastReport Professional v3.0 Full Source

    Changes in FastReport 3.0 (in compare with version 2.5)比较2.5版的改进如下,英文的自己翻译:Core: - Rewritten class architecture. - Storing reports in XML format. - Precise object&#39;s coordinates ...

    kicadStepUp-cheat-sheet.pdf

    edit it in FC Sketcher and PUSH it back to kicad - PUSH & PULL 3D models positions between FreeCAD and KiCAD - ECAD / MCAD Collaboration and Synchronization (compressed 'stpZ' format allowed) ...

Global site tag (gtag.js) - Google Analytics