Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Does Hibernate log all queries?

 
Edmund Yong
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a J2EE application running on WebLogic, and use Hibernate. Our client is reporting about a query being made to their database frequently. I checked our Hibernate log, and just could not find that query. The query is like this: "select count(*) from sometable". As far as I know, Hibernate will log all its queries at the DEBUG level. I have seen all the other queries, but just could not find this particular one. I have also search through all our codes to see if we actually have some query coded like this ("select count(*) ..."), but found nothing.

Help is appreciated. Thanks.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If Hibernate is issuing the query, then it will be in their logs, and you'll see the SQL it generates by setting the hibernate.show_sql property. The client should be able to see what process is issuing the select statement - are they sure it is your application?
 
Edmund Yong
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. We have turn on DEBUG for log4J logging, as well as set hibernate.show_sql to true. The query does not show up in the log file, and it also does not show up in the console.

I have already asked our client to check with their DBA to see if the query is coming from our application. They are using Oracle 9.2, by the way.
 
Edmund Yong
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I know where that query is from. It is from WebLogic. Our Hibernate is using a connection pool defined in WebLogic. In WebLogic's configuration, there is a TestTableName for WebLogic to test the connection pool. And that table name is the one which the "select count(*)" is against.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic