Class StatisticsService

java.lang.Object
org.hibernate.jmx.StatisticsService
All Implemented Interfaces:
StatisticsServiceMBean, Statistics

public class StatisticsService extends Object implements StatisticsServiceMBean
JMX service for Hibernate statistics

Register this MBean in your JMX server for a specific session factory
 //build the ObjectName you want
 Hashtable tb = new Hashtable();
 tb.put("type", "statistics");
 tb.put("sessionFactory", "myFinancialApp");
 ObjectName on = new ObjectName("hibernate", tb);
 StatisticsService stats = new StatisticsService();
 stats.setSessionFactory(sessionFactory);
 server.registerMBean(stats, on);
 
And call the MBean the way you want

Register this MBean in your JMX server with no specific session factory
 //build the ObjectName you want
 Hashtable tb = new Hashtable();
 tb.put("type", "statistics");
 tb.put("sessionFactory", "myFinancialApp");
 ObjectName on = new ObjectName("hibernate", tb);
 StatisticsService stats = new StatisticsService();
 server.registerMBean(stats, on);
 
And call the MBean by providing the SessionFactoryJNDIName first. Then the session factory will be retrieved from JNDI and the statistics loaded.