wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes HQL not selecting data added through backend 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 "HQL not selecting data added through backend" Watch "HQL not selecting data added through backend" New topic
Author

HQL not selecting data added through backend

Sagar Kale
Ranch Hand

Joined: May 02, 2008
Posts: 188
I have one page which shows list of employees. Now load this page in browser and it shows 1 employee. I add employee directly in database through backend procedure( Now table contains 2 employees). When I refresh my webpage which shows employee list, it does not contain newly added employee through backend procedure. When I do refresh on web page, I see hibernate query which selects data from employee table. But new added employee through backend procedure does not come on web page. Which means hibernate has picked up data through cache. How do I force hibernate not to use cache and fire new select on database?
I am using HQL createQuery(" from Emp ").list()
Francois Nadeau
Ranch Hand

Joined: Apr 09, 2009
Posts: 46
Hi Sagar,

You can either remove the cache at the Employee class level



Or remove the cache for all classes in yout hibernate.properties file



Hope this helps.


[url]http://FrancoisNadeau.com[/url]
Sagar Kale
Ranch Hand

Joined: May 02, 2008
Posts: 188
Thanks Francois
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HQL not selecting data added through backend
 
Similar Threads
oracle EM and sql*plus
hibernate caching problem
More Roundtrips or More Data (opinions plz)
Hibernate cache ...
My jsp page does not get refreshed