Open GoogleCodeExporter opened 9 years ago
Original comment by evernat@free.fr
on 10 Jun 2012 at 9:44
I would suggest to publish the hibernate statistics in JMX and then to use
javamelody to view the MBeans for hibernate.
See for example, the MBeans in the javamelody demo (which does not use
hibernate):
http://demo.javamelody.cloudbees.net/monitoring?part=mbeans
To publish the hibernate statistics in JMX, you can do something like the
following when the application is initialized:
//get your hibernate SF
SessionFactory sf = ...;
//get the available MBean servers
List list = MBeanServerFactory.findMBeanServer(null);
//take the first one, or create one
MBeanServer server;
if (!list.isEmpty()) {
server = (MBeanServer) list.get(0);
} else {
server = MBeanServerFactory.createMBeanServer();
}
//build the MBean name
ObjectName on = new ObjectName("Hibernate:type=statistics,application=sample");
StatisticsService mBean = new StatisticsService();
mBean.setSessionFactory(sf);
server.registerMBean(mBean, on);
More information: google or
https://community.jboss.org/wiki/PublishingStatisticsThroughJMX
Original comment by evernat@free.fr
on 10 Jun 2012 at 9:53
+1 native support for hibernate stats would be useful
Original comment by jon.ner...@gmail.com
on 10 Sep 2012 at 4:59
Original issue reported on code.google.com by
jigar.pa...@gmail.com
on 5 Jun 2012 at 4:09