简体   繁体   English

升级到 Java 1.8 后,控制台中未打印的查询。 Hibernate 版本是 5,jboss 是 7

[英]Queries not printing in console after upgrading to java 1.8. Hibernate version is 5 and jboss is 7

When debugging or executing the application queries are not getting printed in the console.调试或执行应用程序查询时,不会在控制台中打印出来。 I am using java 1.8, hibernate 5 and jboss7.我使用的是 java 1.8、hibernate 5 和 jboss7。 For logging purpose log4j-1.2.17.jar is used.出于日志记录目的,使用 log4j-1.2.17.jar。 Is this problem due to any configuration or is it because of the log4j jar version issue?这个问题是由于任何配置还是因为log4j jar版本问题?

Please check the property in your hibernate config xml请检查您的休眠配置 xml 中的属性

<!--hibernate.cfg.xml -->
<property name="show_sql">true</property>

for additional thing you can set these properties对于其他事情,您可以设置这些属性

Format the generated SQL statement to make it more readable, but takes up more screen space -格式化生成的 SQL 语句以使其更具可读性,但占用更多屏幕空间 -

<!--hibernate.cfg.xml -->
<property name="format_sql">true</property>

Hibernate will put comments inside all generated SQL statements to hint what's the generated SQL trying to do - Hibernate 会在所有生成的 SQL 语句中添加注释来提示生成的 SQL 试图做什么 -

<!--hibernate.cfg.xml -->
<property name="use_sql_comments">true</property>

From log4j side check this (for detailed logs - set it as DEBUG)从 log4j 端检查这个(详细日志 - 将其设置为 DEBUG)

log4j.logger.org.hibernate=info

in XML version of log4j config file:在 log4j 配置文件的 XML 版本中:

<logger name="org.hibernate">
  <level value="info"/> 
</logger>

This is because hiberante has cached the results and not going to the database to fetch the records.这是因为 hiberante 已经缓存了结果,而不是去数据库获取记录。

Try a different record and you should see the select statement on the console尝试不同的记录,您应该会在控制台上看到 select 语句

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法应用插件:发现 java 版本 11 最低要求是 1.8。 尚不支持 11.0.0 及更高版本 - Failed to apply plugin: Found java version 11 Minimum required is 1.8. Versions 11.0.0 and newer are not supported yet 避免在jboss控制台上打印休眠日志 - avoid hibernate logs from printing on jboss console JDK 8('1.8.*')的要求检查失败:检测到的版本:null - Requirements check failed for JDK 8 ('1.8.*')! Detected version: null JDK 8 (&#39;1.8.*&#39;) 的需求检查失败! 检测到的版本:13.0.2 - Requirements check failed for JDK 8 ('1.8.*')! Detected version: 13.0.2 更新版本Hibernate Jboss Ejb和Java - Update version Hibernate Jboss Ejb and Java Cordova 构建错误“JDK 8 (&#39;1.8.*&#39;) 的需求检查失败!检测到版本:11.0.2” - Cordova build error "Requirements check failed for JDK 8 ('1.8.*')! Detected version: 11.0.2" Java Applet init非常慢 - java 1.8。 U60 - Java Applet init's very slow - java 1.8. u60 Android Gradle 插件需要 Java 11 才能运行。 您当前使用的是 Java 1.8。 错误 - Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. Error Android Gradle 插件需要 Java 11 才能运行。 您当前使用的是 Java 1.8。 反应原生 - Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. React Native 升级到 Gradle 6 后,Jenkins 控制台上未打印上传的 War 或 Tar 信息 - Uploaded War or Tar information is not printing on Jenkins console after upgrading to Gradle 6
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM