Hi,
I'd like to start profiling all the SQL statements being sent via hibernate to the database, basically to get a total execution + transport time for every db call.
I've played around with the Interceptor and EventListener interfaces and I can capture most statements via flushEvents or postFlush()/preFlush() interception, but I can't seem to find a way to intercept arbitrary hql or native sql statements that go through BasicExecutor.execute(). e.g. something like:
Code:
Query update = session.createQuery("update MyEntity m set m.myField = 'newValue' where m.id = :idToUpdate");
update.setString("idToUpdate", id);
update.executeUpdate();
I can only intercept the transaction start/end and the prepare statement but not the actual flush.
Does anyone know if it's possible to do this with hibernate EventListerners/Interceptors or is Hibernate maybe the wrong place to implement this level of profiling? If it's the latter does anyone have any recommendations for profiling tools?
Thanks,
Stephen