Hi all,
I have set a tipical Hibernate config, using this configurations:
AnnotationConfiguration configuration...
configuration.setProperty(Environment.DIALECT, Oracle10gDialect.class.getName());
configuration.setProperty("hibernate.show_sql", "true");
configuration.setProperty("hibernate.transaction.factory_class", "org.hibernate.transaction.JDBCTransactionFactory");
configuration.setProperty("hibernate.cache.provider_class", "org.hibernate.cache.EhCacheProvider");
configuration.setProperty("hibernate.cache.provider_class", "org.hibernate.cache.EhCacheProvider");
configuration.setProperty("hibernate.cache.use_query_cache", "true");
configuration.setProperty("hibernate.cache.use_second_level_cache", "true");
And this ehcache.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true" monitoring="autodetect" dynamicConfig="true">
<diskStore path="java.io.tmpdir"/>
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="3"
timeToLiveSeconds="3"
overflowToDisk="true"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>
</ehcache>
In this configuration I want that each 3 seconds a new instance of each cached object is refreshed, but this isn´t hapenning. When I execute somethink this:
Object o = hibernateSession.get(clazz, id);
a line that show the SQL generated is shown:
Hibernate: select funcionali0_.FNC_CODIGO as FNC1_540_0_, funcionali0_.FNC_DESCRICAO as FNC2_540_0_, funcionali0_.FNC_NOME as FNC3_540_0_, funcionali0_.FNC_HASHCODE as FNC4_540_0_ from TBL_FUNCIONALIDADES funcionali0_ where funcionali0_.FNC_CODIGO=?
And I´d like that, after 3 seconds (like in the ehcache config) this line should be rewrited if I execute the same method (hibernateSession.get(clazz, id) ), but the SQL isn´t shown. Does anyone know what´s wrong with my cache config ?
Thanks in advance,
Sergio Stateri Jr.
sergio.stateri@globo.com