Another very popularly used framework is Hibernate, used as an ORM (Object Relationship Mapper) layer, traditionally used to translate objects to and from a relational database table. While this goes against the distributed data philosophy we have been exploring with Hazelcast, we may have a legacy application that is currently using it. By adding a caching layer we can improve the scalability and performance of this application, however by enabling this cache layer we will be introducing a data consistency issue; to avoid this we would need an intelligent distributed cache, exactly like Hazelcast.
To enable the use of the cache layer, we must again include the appropriate hazelcast-hibernate-2.6.jar
extension to the classpath. Additionally we need to turn on Hibernate's second level caching functionality and define the Hazelcast region-caching wrapper within its hibernate.cfg.xml
configuration.
<hibernate-configuration> <session-factory> ...