Search This Blog

Wednesday, 28 August 2013

CacheModes in Hibernate

Hibernate offers us a CacheMode option. This is something that allows us to control the behavior of the second level cache. Consider the below code:

Tuesday, 20 August 2013

Testing out the cache

In earlier posts we saw the settings needed for configuring Hibernate's second level cache and the various caches providers supported by Hibernate.
To test out the configurations for Eh Cache, I simply executed a main method to start and create a session factory.

Saturday, 17 August 2013

How to cache ?

In the previous post we saw how to setup the cache provider for Hibernate. But that is not the end of the story. We need to decide what kind of concurrency we need. Does our data ever change? Can we live with stale data? All these factors are decided by the concurrency strategy we use. Hibernate provides us with four built in concurrency strategies (as of version 3.0):

Friday, 16 August 2013

Hibernate Cache Framework

The Hibernate framework comes with a complete caching system. This cache system is used to reduce the amount of SQL queries fired in the system.
The Hibernate cache is built at two levels - a first level or session cache which we saw earlier and the second level cache. While the first level cache is non optional, the second level cache needs to be configured and switched on for use.

Wednesday, 14 August 2013

Accesing System Properties in Java

In an earlier post we saw The ExceptionUtils class provided by the Commons Lang library. The library also provides us with a SystemUtils class - it provides us with information about the JVM in use and the underlying platform. Consider the below code: