-->
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: Session cache refresh
PostPosted: Mon Sep 29, 2003 11:00 am 
Regular
Regular

Joined: Wed Sep 10, 2003 7:09 am
Posts: 63
Hi,

I'm having some problems with session cache and i'm asking for your help.

I have 2 threads each one with it's own session (i call it Session A and B), and they are acessing to a database.

They both load the same object from the database, and Session A changes that record and stores it back in the database. Than both Threads load that object again.

Thread A loads the object with the changes, and Thread B loads the original object. This happens because they are loading the object from their Session Cache instead of loading them from the database.

How can I refresh Session Caches when the database data changes?

Thanks,
Joao Rangel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 29, 2003 12:41 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
It is not usually correct to use such long-lived sessions.

However, there are various ways:

Session.clear(), Session.refresh(), Session.evict(), etc...


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.