Pragmatic Programmer Issues

The saga about Hibernete.

I’ve borrowed book about hibernate. So naturally i want share my experiences with You.

Today we focused on JMX and Hibernate.

Hibernate has two MBean. HibernateServiceMBean which allows you to modify hibernate settings and StatisticsServiceMBean which expose hibernate statistics.

Using jconsole you can change settings, for example you can tell hibernate to write queries to console (very usefull), enabling and disabling cache, setting JDBC parameters, and even changing database access parameters. It is possible to change on the fly all parameters you can set in hibernate.cfg.xml config file.

The second MBean allows you to find out about statistic. So you know about cache hits, entities and collections operations such as fetch, load, remove etc. You can turn on statistic gathering or when you finish you can turn it off.

When you are seeking ORM problems in your application this two MBean are extremely helpful.

I’ve got so much post as drafts, and have no time to finished them. So for now I suggest you to try this MBeans with your application by adding and running jconsole.

Good luck.

Technorati Tags: ,