-->
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: Filtering cache results?
PostPosted: Wed Oct 08, 2008 6:23 pm 
Newbie

Joined: Wed Oct 08, 2008 6:09 pm
Posts: 1
Hi, I'm having trouble doing something that seems like it would be easy with hibernate. Basically, I am caching a view from my database. Each row in the view is represented by a rowDto pojo object. When I load this view into the cache with hibernate I get a List of rowDto objects for every row in the table. Up until now everything is working as expected.

However, there are many times in my code in which I want to retrieve different results from this list. For example, only the rows where rowDto.columnA = 100. The only way I can get this to work is adding the constraint to the where clause and querying the database again. This is a big performance hit. Since I have the whole view cached it seems I should just be able to query the cache with different constraints. I have been searching on this for some time and can't find what I need. Does hibernate not have this functionality? If it does, can someone point me in the right direction?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 08, 2008 7:45 pm 
Expert
Expert

Joined: Mon Nov 26, 2007 2:29 pm
Posts: 443
You are free to traverse your cached collection with Java code in order to achieve what you want.
But, in principle, Hibernate is a layer of persistence against the database, not a collections API.
In other words: no, Hibernate cannot take advantage of the fact that you have all the collection cached.

_________________
Gonzalo Díaz


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.