We have a monitor that displays stats for every sql statement executed on our system. When a query starts the monitor displays "STARTING <sql> at <time> ..."
When the query completes the monitor displays "COMPLETED <sql> Duration <duration> ..."
I know Hibernate has a show_sql flag to have it log its sql. But is there a programmatic way to get the generated sql, so that I can do something like (main desire is to put entry at start-query, and then update entry at end-query):
Code:
Session session = getHibernateSession();
myMonitor.addEntry( session.createCriteria(klass).getGeneratedSQL(), getTime() );
List list = session.createCriteria(klass).list();
myMonitor.updateEntry( session.createCriteria(klass).getGeneratedSQL(), getTime() );
Cheers
[/code]