`

Connection readOnly mode is not enforcable after the connect

阅读更多
环境:
    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
分享到:
评论

相关推荐

    unidac5.3.8src

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

    Devart UniDAC v5.3.8 Source

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

    2009 达内Unix学习笔记

    集合了 所有的 Unix命令大全 ...telnet 192.168.0.23 自己帐号 sd08077-you0 ftp工具 192.168.0.202 tools-toolss ... 各个 shell 可互相切换 ksh:$ sh:$ csh:guangzhou% bash:bash-3.00$ ... 命令和参数之间必需用空格隔...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

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

    DevExpress VCL v2012 vol 1.6源码、例子、帮助-Part1

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

    DevExpress VCL 2012 vol 1.6源码、例子、帮助-Part2

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

    DevExpress VCL v2012 vol 1.6源码、例子、帮助

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

    DevExpress VCL v2012 vol 1.6源码、例子、帮助-part2

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

    DevExpress VCL 2012 vol 1.6源码、例子、帮助-Part1

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

    DevExpress VCL v2012 vol 1.6源码-例子-帮助-part2

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

    DevExpress VCL v2012 vol 1.6源码-例子-帮助-part1

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

    readonly总结

    readonly总结 readonly总结

    QTP处理readonly控件

    QTP处理readonly控件,对于日期控件效果比较好

    php.ini-development

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

    VclZip pro v3.10.1

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

    c#中const与readonly区别

    c#中const与readonly区别

    Universal Data Access Components(UniDAC) 3.00.0.3 Full Source

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

    C#编程中 readonly与const的区别

    C#编程中 readonly与const的区别详解

    RAMAN特性参数(一)exclude/skip readonly/只读表空间备份恢复

    RMAN skip readonly 8 RMAN备份只读表空间 8 RMAN skip readonly 0级备份 8 RMAN skip readonly 恢复 10 只读表空间的备份与恢复 12 1、只读表空间定义和特性 12 2、只读表空间的备份与恢复 13 3、Case1只读表空间的...

    老外写的星级评分效果

    NEW (12-Mar-08): In read only mode (using the 'readOnly' option or disabled property), the plugin is a neat way of displaying star-like values without any additional code <br>效果不错

Global site tag (gtag.js) - Google Analytics