MyBatis Hazelcast integration - Reference Documentation

Hazelcast is an open source clustering and highly scalable data distribution platform for Java.

Users that want to use Hazelcast into their applications, have to download the zip bundle, decompress it and add the jars in the classpath. Apache Maven users instead can simply add in the pom.xml the following dependency:


then, just configure it in the mapper XML

<mapper namespace="org.acme.FooMapper">

  <cache type="org.mybatis.caches.hazelcast.LoggingHazelcastCache"/>




Follows below the version requirements:

MyBatis-Hazelcast Hazelcast
1.0.x 2.x
1.1.x 3.x


There are four Hazelcast cache adapters.

Bean Description
org.mybatis.caches.hazelcast.HazelcastCache No-logging adapter.
org.mybatis.caches.hazelcast.LoggingHazelcastCache Hazelcast cache with logging capabilities. If not sure which to choose then use this one.
org.mybatis.caches.hazelcast.HazelcastClientCache Cache adapter for Hazelcast using "Hazelcast Client" API.
org.mybatis.caches.hazelcast.LoggingHazelcastClientCache Same than the previous but with logging capabilities.

Logging versions of the adapter log cache hit ratios using the namespace as a looger.

Please refer to the official documentation to know more details how to configure Hazelcast as Cache.