File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Hibernate Cache Problem? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate Cache Problem?" Watch "Hibernate Cache Problem?" New topic

Hibernate Cache Problem?

Rod McLure

Joined: Mar 04, 2010
Posts: 24
Hello, I am new to hibernate
I have a jsp page with a Save button on it, which works fine for saving new records
if you are displaying saved data and change it , the changes get written to the database including a timestamp of when you saved
You are then forwarded to a "Load" action which uses the id from the save action to reload the screen from the database
The strange thing is one of the items on the database is a timestamp for when the save button was clicked, it is not entered from
the page, but it should display on the page
if I put a message in my "load" action to display the database fields from the object I have retrieved
I see any fields I changed on the form but the timestamp is always the value of the previous save. The first time it is null, the next time it is the previous value.
I am thinking it is caching this timestamp but I don't know what to do.

the app is developed using a HibernateSessionRequestFilter
//create the interceptor and add it to the HibernateSession
HibernateInterceptor interceptor = new HibernateInterceptor();
Session session = HibernateSessionFactory.getSession(interceptor);
I don't really know what that means,
If anyone has suggestions it would help if you explained it to me as if you were talking to a five year old.
Thank you.

Rod McLure

Joined: Mar 04, 2010
Posts: 24
I think I found the answer
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

Thanks for the postback, Rod!

Sometimes it seems like you're talking to yourself, but this type of kindness to the greater community really helps out.

Glad to have a Greenhorn like yourself on the ranch. Keep posting!

-Cameron McKenzie
I agree. Here's the link:
subject: Hibernate Cache Problem?
It's not a secret anymore!