Configuring ehcache.xml Settings
Because the ehcache.xml file has a defaultCache, caches will always be created when required by Hibernate. However you can gain more control over Hibernate caches by configuring each cache based on its name. Doing this is particularly important, because Hibernate caches are populated from databases, and there is potential for them to become very large. You can control the size of a Hibernate cache by capping its maxEntriesLocalHeap property and specifying whether to swap to disk beyond that.