Skip to main content

Posts

Showing posts from September 24, 2009

HIbernate Performance Tunning

I highly recommend reading them. The first post is directly about tips and tricks when working with Hibernate; and knowing what to do to optimize your queries. The author recommends that unit testing and metrics using System.currentTimeMillis() can help you get the information you need to start the optimization process right. Hibernate 3 also ships with a complete statistics and metrics API that allows you to figure out *everything* that is happening under the covers. All you have to do is a.) enable staticstics for the session factory and b.) retrieve the statistics and use them. Getting them an enabling them is easy: SessionFactory sessionFactory = getSessionFactoryForApplication(); Statistics stats = sessionFactory.getStatistics(); stats.setStatisticsEnabled(true); The tricky part (or at least the part that requires the most attention) is figuring out what statistics are available, and what they really mean. There are a billion methods available on the top level, but here is a glimp...