Ehcache Settings for Collections
Hibernate creates collection cache names based on the fully qualified name of the Domain Object followed by "." and the collection field name. For example, a Country domain object has a set of advancedSearchFacilities. The Hibernate doclet for the accessor looks like this:
/** 
* Returns the advanced search facilities that should appear for this country. 
* @hibernate.set cascade="all" inverse="true" 
* @hibernate.collection-key column="COUNTRY_ID" 
* @hibernate.collection-one-to-many class="com.wotif.jaguar.domain.AdvancedSearchFacility" 
* @hibernate.cache usage="read-write" 
*/ 
public Set getAdvancedSearchFacilities() { 
return advancedSearchFacilities; 
}
You need an additional cache configured for the set. The ehcache.xml configuration looks like this:
<?xml version="1.0" encoding="UTF-8"?> 
<ehcache> 
 <cache name="com.somecompany.someproject.domain.Country" 
    maxEntriesLocalHeap="50" 
    eternal="false" 
    timeToLiveSeconds="600" 
    <persistence strategy="localTempSwap"/> 
/> 
 <cache 
name="com.somecompany.someproject.domain.Country.advancedSearchFacilities" 
    maxEntriesLocalHeap="450" 
    eternal="false" 
    timeToLiveSeconds="600" 
    <persistence strategy="localTempSwap"/> 
/> 
</ehcache>
Hibernate CacheConcurrencyStrategy for Collections
The read-write, nonstrict-read-write and read-only policies apply to Domain Object collections.