I think there is a point that I have not understand yet. I have a class witch have 3 collections of elements in attribute
Code:
public class Pays implements Serializable{
private static final long serialVersionUID = -8767337896773261244L;
/**
* the id of the country
*/
private long id;
/**
* name of the country
*/
private String nom;
/**
* The region of the country
*/
private Region region;
/**
* Relations between a country and a composant
*/
private Set<PaysComposants> pc = new HashSet<PaysComposants>(0);
/**
* Relations between a country and a service
*/
private Set<PaysServices> ps = new HashSet<PaysServices>(0);
/**
* Relations between a country and some keys figures
*/
private Set<KeyFigure> kf = new HashSet<KeyFigure>(0);
on each class and on each getter onf collection, I put
Code:
@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
.
Actually, the only object put in cache is the only the Pays p, the others collections pc, ps and kf are not put in cache.
here is my ehCache.xml
Code:
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true"
monitoring="autodetect" dynamicConfig="true">
<defaultCache maxElementsInMemory="100000" eternal="false"
timeToIdleSeconds="3600" timeToLiveSeconds="3600" overflowToDisk="true" />
<cache name="org.hibernate.cache.internal.StandardQueryCache"
maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="3600"
timeToLiveSeconds="3600">
</cache>
<cache name="org.hibernate.cache.spi.UpdateTimestampsCache"
maxElementsInMemory="10000" eternal="true">
</cache>
My hibernate properties
Code:
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="current_session_context_class">thread</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_structured_entries">true</prop>
<prop key="hibernate.cache.generate_statistics">true</prop>
<prop key="hibernate.cache.provider_class">
org.hibernate.cache.EhCacheProvider
</prop>
<prop key="hibernate.cache.region.factory_class">
org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
</prop>
<prop key="hibernate.cache.provider_configuration_file_resource_path">
applicationContext-ehCache-entity.xml
</prop>
</props>
</property>
I hope that you will help me :)