`

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.

    CX-One Introduction guide

    1. What is CX-One? 2. Features of CX-One 3. Integrated Simulation – New Function in Version 2.0 4. CX-One Component Checklist 5. CX-One Installation Procedure Chapter 2 Example of PLC System ...

    最新的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 ...

    The Objective-C Programming Language-2006.pdf

    faster to develop, more amenable to modification, and easier to understand. Most object-oriented development environments consist of at least three parts: ■ A library of objects ■ A ...

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

    ITUG729源代码

    The changes from Version 1.3 to Version 1.4 do not affect the test vectors. ---------------------------------------------------------------------------- DESCRIPTION ----------- This package ...

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

    unigui0.83.5.820

    - 0000703: TUniDBLookUpxxx bug when datasource and datafield are not assigned - 0000731: Broken TabOrder in 0.82.0 - 0000708: UniGroupBox: Caption assignment when created dynamically - 0000706: ...

    NIST SP800-133.pdf

    data that is sensitive, has a high value, or is vulnerable to unauthorized disclosure or undetected modification during transmission or while in storage. Cryptography relies upon two basic ...

    NIST SP800-133r1-draft.pdf

    data that is sensitive, has a high value, or is vulnerable to unauthorized disclosure or undetected modification during transmission or while in storage. Cryptography relies upon two basic ...

    NIST SP800-53-rev2-final.pdf

    The answers to these questions are not given in isolation but rather in the context of an effective information security program for the organization that identifies, controls, and mitigates risks to ...

Global site tag (gtag.js) - Google Analytics