Why is 'SHOW WARNINGS' query issued here? (JPA/Hibernate/MySQL) -


we refactoring persistence layer of java application jdbc template jpa/hibernate.

i profiling sql statements being issued database , see "show warnings" issued many, many times. according jprofiler "show warnings" accounting considerable amount of 'inherent time'.

what cause show warnings issued frequently?

this show warnings not issued when using jdbc template.

below part of our stack relevant persistence. change here introduction of jpa/hibernate.

  • jpa / hibernate: 4.3.6
  • mysql driver: 5.1.33
  • mysql database: 5.6.20
  • jdbc connection pool: hikaricp-2.3.2

edit: here's sample stack trace of when show warnings issued.

com.mysql.jdbc.statementimpl.getwarnings() com.zaxxer.hikari.proxy.preparedstatementjavassistproxy.getwarnings() org.hibernate.jpa.internal.queryimpl.getsingleresult() com.mysema.query.jpa.impl.abstractjpaquery.getsingleresult(javax.persistence.query) com.mysema.query.jpa.impl.abstractjpaquery.uniqueresult() com.mysema.query.jpa.impl.abstractjpaquery.uniqueresult(com.mysema.query.types.expression) org.springframework.aop.framework.jdkdynamicaopproxy.invoke(java.lang.object, java.lang.reflect.method, java.lang.object[ ]) com.sun.proxy.$proxy115.findone(com.mysema.query.types.predicate) 

this why show warnings being issued: org.hibernate.engine.jdbc.spi.sqlexceptionhelper.handleandclearwarnings() calling com.mysql.jdbc.statementimpl.getwarnings().

a comment in hibernate source code says:

"see hhh-9174. statement#getwarnings can expensive call many jdbc libs. don't unless log level allow warning logged."

i upped logging level on logback.xml on "org.hibernate" error. profiling shows show warnings query no longer being issued.

this has made marginal improvement in performance.

i appreciate input whether idea disable show warnings here.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -