Boa tarde pessoal
estou tentando configurar o ehCache do hibernate em minha aplicação da seguinte maneira: estou com o ehcache-core-2.3.1.jar
hibernate.cfg.xml
<!-- configuracao cache segundo nivel -->
<property name="hibernate.cache.use_second_level_cache">true</property>
<!-- Tentei com este tbm e não tive sucesso -->
<!-- <property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property> -->
<property name="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</property>
<!-- Configuracao de cache de Query -->
<property name="hibernate.cache.use_query_cache">true</property>
Dentro de WEB-INF tenho o seguinte ehcache.xml
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd">
<diskStore path="java.io.tmpdir"/>
<defaultCache
maxElementsInMemory="1000"
eternal="true"
timeToIdleSeconds="3600"
timeToLiveSeconds="7200"
overflowToDisk="false"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>
<cache name="br.com.projeto.model"
maxElementsInMemory="300"
eternal="true"
overflowToDisk="false"
/>
</ehcache>
Tenho as anotações em meus Beans
@Entity
@Table(name="banner_clube")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class BannerClube {
@Id
@GeneratedValue
private Long id;
}
Ao acessar a pagina ele gera uma query no console, ao dar um F5 ele gera de novo a query.
Alguem poderia me dizer onde estou errando?