-->
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: Getting old and new values when I use session.get()
PostPosted: Tue Jan 04, 2005 11:50 pm 
Newbie

Joined: Mon Oct 11, 2004 8:57 pm
Posts: 5
Location: Studio City, CA, USA
This is weird, and is probably due to my inexperience with Hibernate. I'm making changes to my db through Hibernate, and sometimes I still get the old value.

In my web app, I use session.get(MyPoJo.class, pojoID)

When I invoke getName(), my object sometimes returns the name it had BEFORE I changed the db, and sometimes it returns the new saved name.

Interestingly, hibernate seems to be storing two versions of the object, and the session.get seems to return one or the other. Problem is, one is stale.

I've tried using session.refresh() on the object to force it to go back to the db, but the issue remains. I know this probably has something to do with the caching, but I'm lost, and very frustrated.

Any help is very much appreciated!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 05, 2005 5:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if the object was loaded before the database was changed and you haven't updated this exact instance in that session the object will remain the same - This is a Good Thing!

If the above is not the case I would need to see the code you think is failing...

_________________
Max
Don't forget to rate


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.