`

Connection is read-only. Queries leading to data modification are not allowed。

阅读更多
	<tx:advice id="txAdvice" transaction-manager="txManager">
		<tx:attributes>
			<!-- 让所有的方法都加入事务管理,为了提高效率,可以把一些查询之类的方法设置为只读的事务 -->
			
			
			<!-- method name=*, readonly=true表示所有的数据库操作都可以使用,但是只能是读取数据库。
				例如有UserService的方法 listUsers, 获取所有用户,就没问题。
				但是如果是UserService的方法delUser, 要在dao层删除用户。就会报错误如下:
				Connection is read-only. Queries leading to data modification are not allowed。
				因此要添加下面的每一个add*,del*,update*等等。 分别给予访问数据库的权限。
			 -->
			
			<tx:method name="*" propagation="REQUIRED" read-only="true" />
			<!-- 以下方法都是可能设计修改的方法,就无法设置为只读 -->
			<tx:method name="add*" propagation="REQUIRED" />
			<tx:method name="del*" propagation="REQUIRED" />
			<tx:method name="update*" propagation="REQUIRED" />
			<tx:method name="save*" propagation="REQUIRED" />
			<tx:method name="create*" propagation="REQUIRED" />
			<tx:method name="clear*" propagation="REQUIRED" />
			
		</tx:attributes>
	</tx:advice>


在上面的beans.xml配置中, 一开始没有配置add*,del*,update*等等。 就会在调用相应的方法时出错。
而获取数据则没有问题, 是因为有
<tx:method name="*" propagation="REQUIRED" read-only="true" />
分享到:
评论

相关推荐

    hibernate-shards.jar

    of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence ...

    wxPython2.8-win32-unicode-2.8.12.1-py27.exe

    wxPython is a GUI toolkit for the Python programming language. It allows Python ...Since the language is Python, wxPython programs are simple, easy to write and easy to understand. Here is an example.

    mod header-3.1.27.zip

    在IT行业中,"mod"通常是"module"或"modification"的缩写,这可能是一个用于扩展或修改应用程序功能的组件。在这种情况下,“header”可能指的是HTTP头部,因为这是网络通信中非常重要的一部分,尤其是对于Web开发和...

    最新的xwork-core-2.3.7.jar

    * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the ...

    scribe-2.1.tar.gz

    Scribe is a server for aggregating log data streamed in real ... It is designed to be scalable, extensible without client-side modification, and robust to failure of the network or any specific machine.

    gerrit-3.0.3.war

    Issue 11205: Allow Gerrit admins to reindex a change even when Read access is not allowed on its target branch. Extend the addMenuLink method in the PolyGerrit plugin API to allow plugins to specify ...

    hadoop-eclipse-plugin-2.7.3.jar

    Compiled from hadoop2x-eclipse-plugin with some modification. Ant version: 1.9.7. Hadoop version: 2.7.3. Tested on Eclipse Neon.1 Release(4.6.1)

    NIST SP800-52.pdf

    A message integrity service provides confirmation that data modification is always detected thus preventing undetected deletion, addition, or modification of data. An authentication service provides ...

    O-RAN.WG1.Slicing-Architecture-v05.00.pdf

    7. **标准化流程**:说明了O-RAN联盟的标准化流程,包括CR(Change Request)的处理,如RBBN.AO-2021.06.25-WG1-CR-0001-Annex-TN-Slicing-v06和JNPR-2021.05.31-WG1-CR-0004-O-RAN-Slicing-ONSSI-Modification-v02...

    geronimo-book.pdf

    - **License:** Geronimo is distributed under the Apache License, Version 2.0, which allows for free use and modification while preserving the rights of contributors. #### Why Another Application ...

    scribe-2.2.tar.gz

    scribe-2.2.tar.gz 下载地址: ... Scribe is a server for ... It is designed to be scalable, extensible without client-side modification, and robust to failure of the network or any specific machine.

    Senfore_DragDrop_v4.1

    IDataObject.GetData to be called before IDropTarget.Drop is called. ------------------------------------------- 5. Support and feedback: ------------------------------------------- Since these ...

    McGraw.Hill - Hacking.Linux.exposed

    and denial of service, modification of data and systems, and even extortion and hoaxes. Perhaps most tragically, they have undermined many users' enjoyment and confidence as they engage in computing...

    Automate 1.19-1063-1-19-0-1608574964.zip

    MOD全称是Modification,通常由玩家或第三方开发者制作,用于改变游戏的玩法、视觉效果、增加新功能或内容。因此,"Automate"可能是一个允许玩家自动化游戏内某些过程的工具,例如资源采集、建筑过程或角色行为。 ...

    NIST SP800-21.pdf

    Cryptography should be considered for data that is sensitive, has a high value, or is vulnerable to unauthorized disclosure or undetected modification during transmission or while in storage1....

    scribe-version-2.01.tar.gz

    Scribe is a server for aggregating log data streamed in real ... It is designed to be scalable, extensible without client-side modification, and robust to failure of the network or any specific machine.

    Iptables 中文指南

    1. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 2. How to Apply These Terms to Your New Programs I. 示例脚本的代码 I.1. rc.firewall脚本代码 I.2. rc.DMZ.firewall脚本代码 I.3. rc....

    SnakeBite 0.9.1.9-106-0-9-1-9-1616487405.zip

    在IT行业中,MOD是“Modification”的缩写,通常由玩家或第三方开发者为已有的游戏创建,以增加新的功能、内容或改变游戏机制。SnakeBite可能是某个游戏的MOD,旨在提升游戏体验或提供独特的玩法。 标签同样为 "MOD...

    2023-04-06-项目笔记 - 第六十二阶段 - 4.4.2.60全局变量的作用域-60 -2024.03.04

    printf("Before modification: %d\n", globalVar); modifyGlobalVar(); printf("After modification: %d\n", globalVar); return 0; } // 文件2: util.c extern int globalVar; // 外部变量声明 void ...

    3DMGAME-Dying.Light.

    MOD,全称“ Modification”,是指玩家对原版游戏进行修改,以增加新的功能、角色、剧情或者改变游戏原有体验的一种方式。这款MOD资源包针对的是《Dying Light: The Following - Enhanced Edition》的版本1.10到1.15...

Global site tag (gtag.js) - Google Analytics