-->
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.  [ 2 posts ] 
Author Message
 Post subject: Question about query cache and second level cache using
PostPosted: Sat Oct 29, 2011 3:22 pm 
Newbie

Joined: Mon Sep 26, 2011 2:07 pm
Posts: 3
Hi, I'm using hibernate with ehcache (don't think it matters, tho)..
When a user logs in i identify him by his email and i use his email for all subsequent calls.
Now, since email is not my "hibernate id" (the one i annotated with @Id) i have to to load it with a query and thus, store it in the query cache. However, when the user logs out i can't explicitly evict him from the cache since he is stored within a region that it shares with others users that have logged in since.
My question is.. can i load the user into the 2nd level cache (thus making eviction easier) without going again to the database with the session().get(user) method?


Top
 Profile  
 
 Post subject: Re: Question about query cache and second level cache using
PostPosted: Mon Oct 31, 2011 4:38 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
When you want cache entities and retrieve them with identifiers different than the "hibernate id" then the second level query cache is the right place. Thus you are already using the right approach in my opinion.
I just no understand why do feel the necessity to evict users explicitly?
Beside of this you can evict single entities explicitly without evicting the whole region,
there exists apposite api's for that.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.