These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: Second-level cache problems.
PostPosted: Tue Dec 19, 2006 2:31 pm 
Newbie

Joined: Tue Dec 19, 2006 1:44 pm
Posts: 3
Hi all !
I'm trying to use second-level cache in NHibernate .
As it discribed here http://wiki.nhibernate.org/display/NHC/SysCache+Usage.
I use the following description in nhibernate config file :
<property name="hibernate.cache.provider_class">NHibernate.Caches.SysCache.SysCacheProvider,NHibernate.Caches.SysCache</property>
<property name="relativeExpiration">5000</property>
<property name="hibernate.cache.use_query_cache">true</property>

Farther i use <cache usage="read-write"/> in mapping files. Then i'm geting exception NHibernate.MappingException: duplicate cache region.
Did anybody face this problem ? What is my mistake ?
Thx !


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 19, 2006 10:14 pm 
Newbie

Joined: Mon Nov 20, 2006 1:53 am
Posts: 14
How are you getting data from nHibernate?

Clare


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 20, 2006 11:50 am 
Newbie

Joined: Tue Dec 19, 2006 1:44 pm
Posts: 3
What do you mean ? I do it using ICriteria


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 20, 2006 8:12 pm 
Newbie

Joined: Mon Nov 20, 2006 1:53 am
Posts: 14
So you are creating a query?

If so you need to use the query cache.

criteria.SetCacheable(true);
criteria.SetTimeout(300);

Clare


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 21, 2006 7:08 am 
Newbie

Joined: Tue Dec 19, 2006 1:44 pm
Posts: 3
Thanks !
But in which case should i use <cache usage="read-write" /> in mapping files ?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 07, 2007 7:52 pm 
Newbie

Joined: Mon Nov 20, 2006 1:53 am
Posts: 14
I am still trying to figure out using the second level cache myself. I think that the only time that comes into play is when objects are loaded in nHibernate without using a query like by using a Load or a Get.

Clare


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 08, 2007 2:19 am 
Contributor
Contributor

Joined: Sat Sep 24, 2005 11:25 am
Posts: 198
No, there is a difference between the entities cache and the query cache.
The query cache only saves the ids of the entities in the query.
The entities cache saves all the data about them.
The idea here is that a query usually goes to the DB, since that is the authoritative source in the matter, and as long as it goes there, it can get the most recent versions of the entities.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.