How do we configure such that we obtain Hibernate statistics through JMX in Spring MVC based web applications. Is there any better way of tracking Hibernate performance.
Set hibernate.generate_statistics
to true
(either in persistence.xml
or in hibernate.cfg.xml
or in your session factory bean configuration). Then register this bean:
(If you are not using JPA, just specify your sessionFactory
bean instead of getting it through the EMF)
And finally you need an mbean server and exporter: