This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes How to get List of objects from Second Level Cache Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to get List of objects from Second Level Cache" Watch "How to get List of objects from Second Level Cache" New topic
Author

How to get List of objects from Second Level Cache

Ravi K Singh
Greenhorn

Joined: Dec 10, 2008
Posts: 3

I have a requirment where I am using ehcache for hibernate second level cache.
It works fine for me as long as i fetch objects by identifier using load() or get().
But I want to fetch a list of objects using some criteria, this time to goes to database.
I want it to fetch data from second level cache every single time, as I have pre loaded my table in cache.

I don't want to use query cache, please advise if I can achieve my target using Second Level cache only.


Regards,
Ravikant Singh
SCJP1.5 | SCWCD5
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

"Ravi as always", please check your private messages regarding an important administrative matter.

Thank you.
Ravi K Singh
Greenhorn

Joined: Dec 10, 2008
Posts: 3

Anyone please reply how to use createQuery() or createCriteria() on second level cache, i know it works only with load(id) or get(id). but any work arounds for the same.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to get List of objects from Second Level Cache
 
Similar Threads
Using Query cache and second level cache
Can I use Hibernate in my RFID based attendance tracking application?
Modify session or re-fetch from database
regarding QueryCache
What does a SessionFactory object cache?