How to configure second level cache in Hibernate ?

1. Configure Provider class in Hibernate configuration file.

2. Add Cache usage tag ( read-only or read-write ) in mapping files ( hbm ).

3. Create an XML file called ehcache.xml and place in classpath which contains time settings and update settings, behavior of cache , lifetime and idletime of Pojos, how many objects are allowed.