• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

caching for SQL queries via Hibernate not HQL

 
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have a specific table data which I want to load it in hibernate cache (ehcache) and utilize hibernate cache features.
The query operating on this data is a SQL query and not the normal HQL query. How can I utilize cache for SQL queries executed through Hibernate layer.
How to get the entire table data loaded in memory in the first place.

Also what is the better approach here query cache or second level cache.
I need the entire table data (say 1000 rows) and each query will use a subset of it at any given point of time.

Do post your thoughts.


Thanks
 
manish ahuja
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone at least tell me if query caching works for HQL or not. From the Hibernate forum discussions it should work.
I am doing everything from the query caching perspective as listed in this post http://acupof.blogspot.com/2008/01/background-hibernate-comes-with-three.html
It seems the entries are getting into the cache but for subsequent invocations I am not able to see the fetch from the cache instead it ends up in database roundtrip.

log:
checking cached query results in region: org.hibernate.cache.StandardQueryCache

net.sf.ehcache.Cache[661]: org.hibernate.cache.StandardQueryCache cache - Miss
org.hibernate.cache.StandardQueryCache[107]: query results were not found in cache

Please let me know your thoughts.


 
manish ahuja
Ranch Hand
Posts: 312
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Can anyone at least tell me if query caching works for HQL or not. From the Hibernate forum discussions it should work.


Sorry it should be

Can anyone at least tell me if query caching works for plain (raw) SQL queries or not. From the Hibernate forum discussions it should work.


 
Did you ever grow anything in the garden of your mind? - Fred Rogers. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic