views:

46

answers:

1

Hello,

I would like to monitor hibernate action. I see on the internet the zentracker monitor solution that permit to monitor a lot of activity of hibernate.

But It is compatible with the last version of hibernate 3.5.*?

if it's not, do you have solution to monitor query execution time, sessionFactory opened, persitence object created, ... ?

Thank you in advance for your help.

Best regards,

Florent

P.S: I'm french, sorry for my english.

+2  A: 

I see on the internet the zentracker monitor solution that permit to monitor a lot of activity of hibernate. But It is compatible with the last version of hibernate 3.5.x?

Why don't you get the sources and recompile the project with a more recent version of Hibernate Core? Well, I did because I was curious and it doesn't compile, there are a few API changes that require some modifications. But nothing overcomplicated though. And since the project doesn't seem to be very active, your best option would be to make them yourself.

If it's not, do you have solution to monitor query execution time, sessionFactory opened, persitence object created, ... ?

Well, as I said, you can make it compatible...

I personally gather Statistics via JMX and use a custom tool. From the documentation:

20.6.2. Metrics

Hibernate provides a number of metrics, from basic information to more specialized information that is only relevant in certain scenarios. All available counters are described in the Statistics interface API, in three categories:

  • Metrics related to the general Session usage, such as number of open sessions, retrieved JDBC connections, etc.
  • Metrics related to the entities, collections, queries, and caches as a whole (aka global metrics).
  • Detailed metrics related to a particular entity, collection, query or cache region.

For example, you can check the cache hit, miss, and put ratio of entities, collections and queries, and the average time a query needs. Be aware that the number of milliseconds is subject to approximation in Java. Hibernate is tied to the JVM precision and on some platforms this might only be accurate to 10 seconds.

Have a look at Performance Monitoring using Hibernate for more inspiration.

See also

Related questions

References

Pascal Thivent
Like always, thank you for your help. You are very helpful.I have successful make hibernate motinoring operate.
Delildor
nice one pascal.
org.life.java
@Delildor @org.life.java Glad you found this helpful.
Pascal Thivent