Hibernate Second Level Cache Example

To enable second level cache, here we will use EHCache.
Change mapping file category.hbm.xml, and one line

add one ehcache.xml, a simple example

Let’s use the same code as we used in the 1st level cache example

The output:

Part of Hibernate Debug level log

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on RedditShare on StumbleUponEmail this to someoneShare on TumblrDigg this

One thought on “Hibernate Second Level Cache Example

  1. Pingback: Hibernate Caching

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">