Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
[b]Hibernate version:3.0[/b]
[b]Mapping documents:
Here is part of my hibernate.cfg.xml:
..................
<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
............
Here is part of my customer.hbm.xml:
..............
<class
name="com.gloptv.smsc.Customer"
table="customer"
lazy="true"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
>
<cache usage="nonstrict-read-write" />
.............
here is part of my ehcache.xml placed in my classpath
.............
<cache name="org.hibernate.cache.StandardQueryCache"
maxElementsInMemory="100"
eternal="false"
timeToLiveSeconds="86400"
overflowToDisk="true"/>
<cache name="query.CustomerList"
maxElementsInMemory="100"
eternal="false"
timeToLiveSeconds="86400"
overflowToDisk="true"/>
<!-- UpdateTimestampsCache -->
<cache name="org.hibernate.cache.UpdateTimestampsCache"
maxElementsInMemory="5000"
eternal="true"
overflowToDisk="true"/>
...............
[/b]
[b]Code between sessionFactory.openSession() and session.close():
static public List getCustomerList() throws Exception
{
Session session = HibernateUtil.currentSession();
session.connection().setAutoCommit(true);
Query query = session.createQuery("FROM Customer c");
query.setCacheable(true);
query.setCacheRegion("query.CustomerList");
return query.list();
}
[/b]
[b]Full stack trace of any exception that occurs:[/b]
[b]Name and version of the database you are using:postgresql 8.0[/b]
[b]The generated SQL (show_sql=true):
select customer0_.id as id, customer0_.name as name0_, customer0_.is_deleted as is3_0_, customer0_.user_id as user4_0_ from customer customer0_
[/b]
[b]Debug level Hibernate log excerpt:[/b]
My problem is that caching is not working at all after having made all the necessary configuration. If I've missed something please let me know. Each time I call my function getCustomerList I found in my postgresql log doing a select in the database. Can anyone please help me solve my problem
thanks in advance