-->
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: Cache problem with updatin a list of objects
PostPosted: Wed May 24, 2006 4:30 pm 
Newbie

Joined: Wed May 24, 2006 4:07 pm
Posts: 1
I'm here struggling with quite a cache problem. Why hibernate does not return the changes that already propagated to mySql database. I am running resin pro as app server.
I created 69 "product" objects and persisted to MySql.
After getting all of them to a browser page and update some properties of some (say 5) product objects and session.update then session.flush then commit to db. MySql shows correct data for all 69 products but when I reload/ re get the list of 69 products, some of the 5 rows I modified show latest data, some show old data. And the more confusing things are sometimes the list show new/correct data, sometime old data.
Closing and restarting browser (IE and NS) does not help, restart resin (app server) always results in correct data. Any one has similar problems?
Thanks alot in advance.

Hibernate version: 3.0

Mapping documents:

Code between sessionFactory.openSession() and session.close():


Full stack trace of any exception that occurs:

Name and version of the database you are using:MySql 5.0

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 24, 2006 7:01 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
That looks like a symptom of accidentally using long sessions. Are you creating a new hiberante session for every web request? And are you closing the hibernate session at the end of the request? You have to either do that, or (if you're deliberately using long sessions) set a short expiry time on your cache. Check your cache's documentation for info on how to do that.

_________________
Code tags are your friend. Know them and use them.


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.