环境:
WebSphere Server v6.0.22 , Spring , Hibernate ,远程 DB2 v8.2 ,JDBC驱动: IBM DB2 JDBC Type 4 driver.
Spring配置文件:
问题:
org.hibernate.util.JDBCExceptionReporter logWarnings Connection readOnly mode is not enforcable after the connection has been established. To enforce a read only connection, set the readOnly data source or connection property.
原因:
the read-only flag is a kind of stepchild in the JDBC spec... Many drivers (and DBMS) don't really support a true read-only transaction. Some do optimize transaction processing, though, so setting the readOnly flag is nevertheless usually worth it.
In your case, the driver simply isn't able to switch the connection to true read-only mode and logs a corresponding warning. This can safely be ignored; your transaction won't get read-only optimizations, but that doesn't hurt.
You could remove the "readOnly" marker from your transaction attribute to avoid the warning. However, "readOnly" also triggers other optimizations, for example it suppresses Hibernate flush attempts for read-only operations, so I recommend to keep those markers and simply ignore the warnings.
I discovered that setting the "readOnly" marker is more than a nice-to-have.
I had a problem
http://forum.springframework.org/viewtopic.php?t=4849 when using Spring MVC where despite having validation errors in my onBindAndValidate() method, the bad user entered values bound to my domain objects would get persisted by Hibernate. Turned out that this was because I had the transaction attribute for all service methods without the readOnly marker.
The POJO's are detached in the Spring Form/Command object between requests. When a form is submitted, Spring binds back to these POJO's and since I'm using the Open Session In View (OSIV) pattern, when the request completes the Hibernate transaction commits (at this point the web page is displayed back to the user with validation errors) . The detached objects are brought in context of the Hibernate session before commit takes place.
http://forum.springframework.org/showthread.php?t=12637
分享到:
相关推荐
Bug with connection when UnicodeEnvironment=True in the Direct mode is fixed Bug with detecting table names in an SQL statement containing JOIN is fixed Bug with Largint columns in UniLoader is ...
-Bug with connection when UnicodeEnvironment=True in the Direct mode is fixed -Bug with detecting table names in an SQL statement containing JOIN is fixed -Bug with Largint columns in UniLoader is ...
集合了 所有的 Unix命令大全 ...telnet 192.168.0.23 自己帐号 sd08077-you0 ftp工具 192.168.0.202 tools-toolss ... 各个 shell 可互相切换 ksh:$ sh:$ csh:guangzhou% bash:bash-3.00$ ... 命令和参数之间必需用空格隔...
connector's end point moving, the link is breaks if the move was not on one of the flex-controls connection points. Contain False as default. - ADD Added ControlDocRect parameter in event ...
Q434043 - Background and text colors are not applied to a read-only editor if its Properties.ReadOnly property is set via RepositoryItem Q434045 - cxMemo - Scrollbars are not shown if the editor is ...
Q434043 - Background and text colors are not applied to a read-only editor if its Properties.ReadOnly property is set via RepositoryItem Q434045 - cxMemo - Scrollbars are not shown if the editor is ...
Q434043 - Background and text colors are not applied to a read-only editor if its Properties.ReadOnly property is set via RepositoryItem Q434045 - cxMemo - Scrollbars are not shown if the editor is ...
Q434043 - Background and text colors are not applied to a read-only editor if its Properties.ReadOnly property is set via RepositoryItem Q434045 - cxMemo - Scrollbars are not shown if the editor is ...
Q434043 - Background and text colors are not applied to a read-only editor if its Properties.ReadOnly property is set via RepositoryItem Q434045 - cxMemo - Scrollbars are not shown if the editor is ...
Q434043 - Background and text colors are not applied to a read-only editor if its Properties.ReadOnly property is set via RepositoryItem Q434045 - cxMemo - Scrollbars are not shown if the editor is ...
Q434043 - Background and text colors are not applied to a read-only editor if its Properties.ReadOnly property is set via RepositoryItem Q434045 - cxMemo - Scrollbars are not shown if the editor is ...
### QTP处理readonly控件 在自动化测试领域中,QTP(Quick Test Professional)是一款非常受欢迎的工具,它主要用于功能测试、回归测试等自动化测试任务。对于某些特定类型的控件,如只读(readonly)控件,QTP提供...
在编程领域,`readonly` 是一个非常重要的关键字,它用于定义只读属性或变量。`readonly` 关键字在多种编程语言中都有所应用,包括 C#、Java、C++、JavaScript 等。本篇文章将深入探讨 `readonly` 的含义、用法以及...
An empty string can be denoted by simply not writing anything after the equal ; sign, or by using the None keyword: ; foo = ; sets foo to an empty string ; foo = None ; sets foo to an empty string ;...
在C#编程语言中,`const`和`readonly`关键字都是用来声明不可变变量的,但它们之间存在一些重要的区别,这些区别主要体现在初始化、作用域、存储位置以及使用场景等方面。 ### 1. 初始化 - **const**:`const`...
### C#编程中 readonly与const的区别详解 #### 一、概述 在C#编程语言中,`readonly`和`const`这两个关键字都用于定义只读字段,但它们之间存在一些重要的区别。理解这些区别有助于更好地设计和实现软件系统,尤其...
- If a file does not extend beyond any of the original limitations (filesizes of 4 gig or 65535 files) then no Zip64 format information is included in the archive. - property isZip64 - tells you when ...
Now setting the SetFieldsReadOnly option to False makes all fields not readonly Now the AssignConnect method copies transaction state Fixed bug with locating records using the LocateEx method and ...
- NOT_SUPPORTED:如果当前存在事务,则暂停当前事务;如果不存在,则不开启事务。 - NEVER:如果当前存在事务,则抛出异常;如果不存在,则不开启事务。 - NESTED:如果当前存在事务,则在嵌套事务内执行;如果...
MySQL服务器在运行时可能由于配置了`--read-only`选项,导致无法执行写入操作,从而出现"1209 - The MySQL server is running with the --read-only option so it cannot execute this statement"的错误。...