I'm using Hibernate 4.1.5.Final, Spring 3.1.1.RELEASE, JUnit 4.8.1 and JPA 2.0. I'm trying to test if my second-level cache is set up properly, but I can't figure out how to hit the second level cache. Does anyone know how I can
1.) Evict an entity from the first level cache or
2.) Create a new session within my entity manager in a single JUnit test?
Here's my DAO that I'm trying to test …
Here's the JUnit test …
I think the assertion is failing because I'm using the same session and so my entity is being cached within the first level cache. I'd like to test hitting the second level cache.
Thanks, - Dave
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: How do I evict data from the Hibernate first level cache (but not the second level cache)?