Hi all,
I am trying to customize/enhance the processing of the query statistics: In short I'd like to provide a concrete implementation of the StatisticsImplementor interface to Hibernate:
Code:
public interface StatisticsImplementor {
...
public void queryExecuted(String hql, int rows, long time);
...
}
This is invoked by Loader as follows:
Code:
/**
* Actually execute a query, ignoring the query cache
*/
protected List doList(final SessionImplementor session, final QueryParameters queryParameters)
throws HibernateException {
...
if ( stats ) {
getFactory().getStatisticsImplementor().queryExecuted(
getQueryIdentifier(),
result.size(),
System.currentTimeMillis() - startTime
);
}
...
}
I have a class implementing Statistics and StatisticsImplementor in the same fashion as Hibernate's StatisticsImpl but
I could find no lead on the web, the forums, the documentation as to whether/how to get Hibernate to use it.
Having browsed through the code it all seem to derive from the implementor version of the session factory and the session.
It seems a tad involved to have to code new concrete implementations of SessionFactory/SessionFactoryImplementor, Session/SessionImplementor just for the purpose of overriding the getStatistics/getStatisticsImplementor. I tried wrapping Hibernate classes and got nowhere. Did I miss something?
Has anyone customized the statistics? Any suggestion?
Thanks for your help guys, I am stuck!