The saga about Hibernete.

Posted in java by pedro | Saturday, February 24th, 2007 at 3:22 pm

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 -Dcom.sun.management.jmxromote and running jconsole.

Good luck.

Technorati Tags: ,

Leave a Reply

about me

My name is Sebastian Pietrowski. I've finished Warsaw University as Master degree. I started my journey with Java 1.1 with Thread and JDBC programing in 1998 as I worked for merlin.pl. In 1999 I've passed Java Programer Certificate for Java 1.2, and was solution architect of merlin.pl infrastructure when we was moving from pl/sql to J2EE. It was great performance optimization with 10 times more req/sec than in requirements and 85 times faster as original solution.

Currently I work as Expert Software Development Java at F.Hoffmann-La Roche. The company was founded in 1896 and today, Roche employs over 80.000 people. After work I'm involved in activities related to Scala/Lift, Ruby/Rails/Merb, Python/Django. This is because I try to be pragmatic also I'm focused on application performance and tuning with success in my daily work.

My Yoda's motto: Do, or do not. There is no try.