`
lydawen
  • 浏览: 476721 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

hibernate报一些警告信息

    博客分类:
  • ssh
阅读更多

出错信息类似:

[2008-12-08 12:46:33.10 GMT+08:00] [WARN ] [org.hibernate.util.JDBCExceptionReporter] SQL Warning: 0, SQLState:
[2008-12-08 12:46:33.10 GMT+08:00] [WARN ] [org.hibernate.util.JDBCExceptionReporter] [BEA][Sybase JDBC Driver]Database changed to DBNAME

[2008-12-08 12:46:33.10 GMT+08:00] [WARN ] [org.hibernate.util.JDBCExceptionReporter] SQL Warning: 0, SQLState:
[2008-12-08 12:46:33.10 GMT+08:00] [WARN ] [org.hibernate.util.JDBCExceptionReporter] [BEA][Sybase JDBC Driver]Language changed to us_english

 

这些是通过查看weblogic日志发现的一些情况,且出现频率比较高,但应用又正常,查遍网络,最终在一个帖子中找到,并在springframework网站一个帖子找到了原委:

 

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

--------------------------------------------------

 

springframework.org 上原帖:

http://forum.springframework.org/showthread.php?t=12637

 

 

原帖内容:

 

All,
I have an application running on WebSphere Server v5.1.1 that uses Spring and Hibernate to access a remote DB2 v8.2 database via IBM DB2 JDBC Type 4 driver. I have a method whose transaction attribute is set to readonly through Spring config file

******* BEGIN SPRING CONFIG FILE **********
...
<bean id="organizationService" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
<property name="transactionManager"><ref bean="transactionManager"/></property>
<property name="target"><ref local="organizationServiceTarget"/></property>
<property name="transactionAttributes">
<props>
<prop key="executeOrganizationSearch">PROPAGATION_REQUIR ED,readOnly</prop>
</props>
</property>
</bean>
...
******* END SPRING CONFIG FILE **********

It retrieves the information I need but it keeps giving the following warning:

"JDBCExceptionReporter - SQL Warning
com.ibm.db2.jcc.b.SqlWarning: 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. "

I do not have this problem when I use IBM DB2 JDBC TYPE 2, but applications in production environment must use TYPE 4 driver.


******* BEGIN WARNING *******
...
2005-01-26 18:18:21,717 DEBUG TransactionInterceptor - Invoking commit for trans
action on method 'executeOrganizationSearch' in class [us.il.state.idph.fdd.serv
ice.demographics.OrganizationService]
2005-01-26 18:18:21,717 DEBUG HibernateTransactionManager - Triggering beforeCom
mit synchronization
2005-01-26 18:18:21,718 DEBUG HibernateTransactionManager - Triggering beforeCom
pletion synchronization
2005-01-26 18:18:21,718 DEBUG HibernateTransactionManager - Initiating transacti
on commit
2005-01-26 18:18:21,718 DEBUG HibernateTransactionManager - Committing Hibernate
transaction on session [net.sf.hibernate.impl.SessionImpl@1e05ce0]
2005-01-26 18:18:21,718 DEBUG JDBCTransaction - commit
2005-01-26 18:18:21,719 DEBUG SessionImpl - transaction completion
2005-01-26 18:18:21,719 DEBUG JDBCTransaction - re-enabling autocommit
2005-01-26 18:18:21,719 DEBUG HibernateTransactionManager - Triggering afterComp
letion synchronization
2005-01-26 18:18:21,720 DEBUG TransactionSynchronizationManager - Clearing trans
action synchronization
2005-01-26 18:18:21,720 DEBUG TransactionSynchronizationManager - Removed value
[org.springframework.orm.hibernate.SessionHolder@6d d766] for key [net.sf.hiberna
te.impl.SessionFactoryImpl@11bd50e] from thread [Servlet.Engine.Transports : 0]
2005-01-26 18:18:21,720 DEBUG TransactionSynchronizationManager - Removed value
[org.springframework.jdbc.datasource.ConnectionHold er@1a9f278] for key [com.ibm.
ws.rsadapter.jdbc.WSJdbcDataSource@1ac9cff] from thread [Servlet.Engine.Transpor
ts : 0]
2005-01-26 18:18:21,720 DEBUG DataSourceUtils - Resetting read-only flag of conn
ection [com.ibm.ws.rsadapter.jdbc.WSJccConnection@1620aa9]
2005-01-26 18:18:21,721 DEBUG HibernateTransactionManager - Closing Hibernate se
ssion [net.sf.hibernate.impl.SessionImpl@1e05ce0] after transaction
2005-01-26 18:18:21,721 DEBUG SessionFactoryUtils - Closing Hibernate session
2005-01-26 18:18:21,721 DEBUG SessionImpl - closing session
2005-01-26 18:18:21,721 DEBUG SessionImpl - disconnecting session
2005-01-26 18:18:21,722 DEBUG JDBCExceptionReporter - SQL Warning
com.ibm.db2.jcc.b.SqlWarning: Connection readOnly mode is not enforcable after t
he connection has been established. To enforce a read only connection, set the r
eadOnly data source or connection property.
at com.ibm.db2.jcc.b.o.setReadOnly(o.java:1507)
at com.ibm.db2.jcc.b.wb.setReadOnly(wb.java:202)
at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImp l.setReadOnly(WSRdb
ManagedConnectionImpl.java:3280)
at com.ibm.ws.rsadapter.spi.InternalGenericDataStoreH elper.setReadOnly(I
nternalGenericDataStoreHelper.java:266)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.setRead Only(WSJdbcConnecti
on.java:2115)
at org.springframework.jdbc.datasource.DataSourceUtil s.prepareConnection
ForTransaction(DataSourceUtils.java:194)
at org.springframework.orm.hibernate.HibernateTransac tionManager.doBegin
(HibernateTransactionManager.java:378)
at org.springframework.transaction.support.AbstractPl atformTransactionMa
nager.getTransaction(AbstractPlatformTransactionMa nager.java:269)
at org.springframework.transaction.interceptor.Transa ctionAspectSupport.
createTransactionIfNecessary(TransactionAspectSupp ort.java:200)
at org.springframework.transaction.interceptor.Transa ctionInterceptor.in
voke(TransactionInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(
ReflectiveMethodInvocation.java:138)
at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynami
cAopProxy.java:152)
at $Proxy0.executeOrganizationSearch(Unknown Source)
at us.il.state.idph.fdd.web.party.SearchOrganizationA ction.getSearchOrga
nization(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchM ethod(DispatchActio
n.java:278)
at org.apache.struts.actions.DispatchAction.execute(D ispatchAction.java:
218)
...
******* END WARNING *******

I hope you guys can help me. Thanks !

Regards,
Guillermo
<!---->Reply With Quote <!---->
<!---->
  #2  
<!---->Old Jan 27th, 2005, 06:20 AM <!---->
<!---->
Juergen Hoeller Juergen Hoeller is offline <script type="text/javascript"></script>
Senior Member
Spring Team
 
Join Date: Aug 2004
Location: Linz, Austria
Posts: 391
<!---->
<!----><!---->
Default

<!----><!---->
Well, 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.

Juergen
<!---->
<!---->Reply With Quote <!---->
<!---->
<!----> <!---->
<!---->
  #3  
<!---->Old Apr 15th, 2005, 06:48 PM <!---->
<!---->
sjivan sjivan is offline <script type="text/javascript"></script>
Senior Member
 
Join Date: Sep 2004
Location: Boston, US
Posts: 130
<!---->
<!----><!---->
Default

<!----><!---->
Quote:
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.

Code:
<prop key="*">PROPAGATION_REQUIRED</prop>
After changing the transaction attributes to
Code:
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
the invalid bean properties did not get persisted if validation errors were present.

Sanjiv

 

分享到:
评论

相关推荐

    防止Hibernate报警告

    如何防止 Hibernate报警告 WARM:.... 将这个资源放到你的 src 目录下就可以了。

    errors code

    日志中还包含了关于log4j的警告信息,指出无法为`org.springframework.web.context.ContextLoader`找到appender,提示需要正确初始化log4j系统。解决这个问题通常涉及: - **配置log4j属性文件**:在项目中引入log4j...

    一种基于分布式网络入侵检测系统的实现.pdf

    数据收集模块负责从网络中捕获流量信息,分析模块对收集到的数据进行深度分析,识别异常行为,报警模块则在检测到入侵行为时及时发出警告,而响应模块则根据预设策略采取相应措施,如隔离受影响的系统或网络段。...

    一种基于SpringBoot架构下的水质监测系统设计.docx

    异常报警需要设定阈值,当水质指标超出正常范围时,系统能自动触发警告。数据分析则可能涉及到统计计算、趋势预测等,以支持决策制定。 3.2 系统架构设计 基于 SpringBoot 的水质监测系统通常采用微服务架构,将...

    《数据结构》(02331)基础概念

    内容概要:本文档《数据结构》(02331)第一章主要介绍数据结构的基础概念,涵盖数据与数据元素的定义及其特性,详细阐述了数据结构的三大要素:逻辑结构、存储结构和数据运算。逻辑结构分为线性结构(如线性表、栈、队列)、树形结构(涉及根节点、父节点、子节点等术语)和其他结构。存储结构对比了顺序存储和链式存储的特点,包括访问方式、插入删除操作的时间复杂度以及空间分配方式,并介绍了索引存储和散列存储的概念。最后讲解了抽象数据类型(ADT)的定义及其组成部分,并探讨了算法分析中的时间复杂度计算方法。 适合人群:计算机相关专业学生或初学者,对数据结构有一定兴趣并希望系统学习其基础知识的人群。 使用场景及目标:①理解数据结构的基本概念,掌握逻辑结构和存储结构的区别与联系;②熟悉不同存储方式的特点及应用场景;③学会分析简单算法的时间复杂度,为后续深入学习打下坚实基础。 阅读建议:本章节内容较为理论化,建议结合实际案例进行理解,尤其是对于逻辑结构和存储结构的理解要深入到具体的应用场景中,同时可以尝试编写一些简单的程序来加深对抽象数据类型的认识。

    【工业自动化】施耐德M580 PLC系统架构详解:存储结构、硬件配置与冗余设计

    内容概要:本文详细介绍了施耐德M580系列PLC的存储结构、系统硬件架构、上电写入程序及CPU冗余特性。在存储结构方面,涵盖拓扑寻址、Device DDT远程寻址以及寄存器寻址三种方式,详细解释了不同类型的寻址方法及其应用场景。系统硬件架构部分,阐述了最小系统的构建要素,包括CPU、机架和模块的选择与配置,并介绍了常见的系统拓扑结构,如简单的机架间拓扑和远程子站以太网菊花链等。上电写入程序环节,说明了通过USB和以太网两种接口进行程序下载的具体步骤,特别是针对初次下载时IP地址的设置方法。最后,CPU冗余部分重点描述了热备功能的实现机制,包括IP通讯地址配置和热备拓扑结构。 适合人群:从事工业自动化领域工作的技术人员,特别是对PLC编程及系统集成有一定了解的工程师。 使用场景及目标:①帮助工程师理解施耐德M580系列PLC的寻址机制,以便更好地进行模块配置和编程;②指导工程师完成最小系统的搭建,优化系统拓扑结构的设计;③提供详细的上电写入程序指南,确保程序下载顺利进行;④解释CPU冗余的实现方式,提高系统的稳定性和可靠性。 其他说明:文中还涉及一些特殊模块的功能介绍,如定时器事件和Modbus串口通讯模块,这些内容有助于用户深入了解M580系列PLC的高级应用。此外,附录部分提供了远程子站和热备冗余系统的实物图片,便于用户直观理解相关概念。

    某型自动垂直提升仓储系统方案论证及关键零部件的设计.zip

    某型自动垂直提升仓储系统方案论证及关键零部件的设计.zip

    2135D3F1EFA99CB590678658F575DB23.pdf#page=1&view=fitH

    2135D3F1EFA99CB590678658F575DB23.pdf#page=1&view=fitH

    agentransack文本搜索软件

    可以搜索文本内的内容,指定目录,指定文件格式,匹配大小写等

    Windows 平台 Android Studio 下载与安装指南.zip

    Windows 平台 Android Studio 下载与安装指南.zip

    Android Studio Meerkat 2024.3.1 Patch 1(android-studio-2024.3.1.14-windows-zip.zip.002)

    Android Studio Meerkat 2024.3.1 Patch 1(android-studio-2024.3.1.14-windows.zip)适用于Windows系统,文件使用360压缩软件分割成两个压缩包,必须一起下载使用: part1: https://download.csdn.net/download/weixin_43800734/90557033 part2: https://download.csdn.net/download/weixin_43800734/90557035

    4-3-台区智能融合终端功能模块技术规范(试行).pdf

    国网台区终端最新规范

    4-13-台区智能融合终端软件检测规范(试行).pdf

    国网台区终端最新规范

    【锂电池剩余寿命预测】Transformer-GRU锂电池剩余寿命预测(Matlab完整源码和数据)

    1.【锂电池剩余寿命预测】Transformer-GRU锂电池剩余寿命预测(Matlab完整源码和数据) 2.数据集:NASA数据集,已经处理好,B0005电池训练、B0006测试; 3.环境准备:Matlab2023b,可读性强; 4.模型描述:Transformer-GRU在各种各样的问题上表现非常出色,现在被广泛使用。 5.领域描述:近年来,随着锂离子电池的能量密度、功率密度逐渐提升,其安全性能与剩余使用寿命预测变得愈发重要。本代码实现了Transformer-GRU在该领域的应用。 6.作者介绍:机器学习之心,博客专家认证,机器学习领域创作者,2023博客之星TOP50,主做机器学习和深度学习时序、回归、分类、聚类和降维等程序设计和案例分析,文章底部有博主联系方式。从事Matlab、Python算法仿真工作8年,更多仿真源码、数据集定制私信。

    基于android的家庭收纳App的设计与实现.zip

    Android项目原生java语言课程设计,包含LW+ppt

    大学生入门前端-五子棋vue项目

    大学生入门前端-五子棋vue项目

    二手车分析完整项目,包含源代码和数据集,包含:XGBoost 模型,训练模型代码,数据集包含 10,000 条二手车记录的数据集,涵盖车辆品牌、型号、年份、里程数、发动机缸数、价格等

    这是一个完整的端到端解决方案,用于分析和预测阿联酋(UAE)地区的二手车价格。数据集包含 10,000 条二手车信息,覆盖了迪拜、阿布扎比和沙迦等城市,并提供了精确的地理位置数据。此外,项目还包括一个基于 Dash 构建的 Web 应用程序代码和一个训练好的 XGBoost 模型,帮助用户探索区域市场趋势、预测车价以及可视化地理空间洞察。 数据集内容 项目文件以压缩 ZIP 归档形式提供,包含以下内容: 数据文件: data/uae_used_cars_10k.csv:包含 10,000 条二手车记录的数据集,涵盖车辆品牌、型号、年份、里程数、发动机缸数、价格、变速箱类型、燃料类型、颜色、描述以及销售地点(如迪拜、阿布扎比、沙迦)。 模型文件: models/stacking_model.pkl:训练好的 XGBoost 模型,用于预测二手车价格。 models/scaler.pkl:用于数据预处理的缩放器。 models.py:模型相关功能的实现。 train_model.py:训练模型的脚本。 Web 应用程序文件: app.py:Dash 应用程序的主文件。 callback

    《基于YOLOv8的船舶航行违规并线预警系统》(包含源码、可视化界面、完整数据集、部署教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计.zip

    资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。

    《基于YOLOv8的工业布匹瑕疵分类系统》(包含源码、可视化界面、完整数据集、部署教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计.zip

    资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。

    CodeCount.exe

    此为代码审查工具 可查 文件数,字节数,总行数,代码行数,注释行数,空白行数,注释率等

Global site tag (gtag.js) - Google Analytics