I\'m using Spring Boot 1.2.5 with JPA2 to annotate entities (and hibernate as underlaying JPA implementation).
I wanted to use second level cache in that setup, so e
You should have an ehcache.xml file in your classpath. The file should contains at least the default cache strategy. For easier debuging, make it eternal to be sure entities are not evicted from cache :
ehcache.xml:
To ensure that all is ok, you should have the following log during your application startup :
Could not find a specific ehcache configuration for cache named [com.yourcompany.YourClass]; Using defaults.
That means that your entity cache annotation have been correctly readed and default cache will be used.
If you test with entityManager.find(Clazz.class, pk)
that's not envolve the query cache, but just the entity cache. Query cache is used for queries (em.createQuery(...) and for relations ship
Also, I use org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory, but I don't know wich is better.