Why do you think it's too specific?
About parsing the execution time: If you were using an own SLF4J Logger, you wouldn't even have to parse the string to get the execution time, because the time is passed in another parameter than the message-string. But I know that it is quite complex to write an own SLF4J appender. I have done it with a log4j-appender, where I had to parse the string, which is very easy though, because it always looks the same.
Quote:
Secondly, for me it's not an option to fork the Hibernate source code. My "plug-in" is expected to work "out-of-the-box" with a web-application, and forking the Hibernate source code in a production environment, even if we're talking about a few lines of code, is not an option. Therefore, the only thing I can assume is that I have Hibernate newer than version X and Spring newer than version Y.
It may take some versions, until hibernate supports logging the execution time of each query, I don't think you'll want to wait for it. Anyway, my patch adds only a single line of code, so what's the deal changing it. That's the idea of open source. But I can understand you, I don't like to change it either.
Quote:
So, anyone, is there any other way to display HQL query execution time? Maybe using Spring AOP?
I haven't done it using AOP yet, but it could be a possible solution. I don't think there are good join points in hibernate's source, as the HQL-Queries are executed within more complex methods, so you would measure not only the execution time. You could use the JDBS-execute-methods as join points and measure the time it took to execute them. But this would be the same as using a p6spy-driver.
Anyway, I am curious about you finding a solution for that problem. Keep me updated, please.