I am using Hibernate 4.17 and use ehcache as second level cache. In the definition of hbm file, I declare the cache at the class level.
<class name="com.test.Program" table="program" mutable="false">
<cache usage="nonstrict-read-write" />
....
I have 1-to-many association defined as follows
<list name="parameters" cascade="none" batch-size="100">
<cache usage="nonstrict-read-write" />
<key column="program_oid"/>
<index column="sequence" />
<one-to-many class="com.test.ProgramParameter"/>
</list>
I have a region defined for main class - Program in the ehcache.xml. The issue is whenever I evict the 2nd level cache using
HibernateUtil.getSessionFactory().getCache().evictEntityRegion("com.test.Program");
All the entities of com.test.Program are evicted but not com.test.Program.parameters Further more, If I try to evict com.test.Program.parameters entities like above, I get the exception "Unknown Entity".
How do I evict the entities of associated class?