Saturday, April 14, 2007
Getting SQL statistics from Hibernate
It is important to be able to see the SQL queries hibernate is generating. There are two suitable options here:
It is important to be able to see the SQL queries hibernate is generating. There are two suitable options here:
- Get them via log4j: just add the following logger to the log4j properties file: "log4j.logger.org.hibernate.SQL=DEBUG, SQLappender", where SQLappender is a log4j appender defined somwhere else.
- Use the hibernate statistics package: there are some useful classes and interfaces under the org.hibernate.stat package which you can use to get query statistics (http://www.hibernate.org/hib_docs/v3/api/org/hibernate/stat/package-summary.html)
Labels: hibernate, java, statistics
Subscribe to Posts [Atom]