-->
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.  [ 4 posts ] 
Author Message
 Post subject: Refresh all objects with same ID as saved object
PostPosted: Mon Sep 10, 2007 7:30 am 
Beginner
Beginner

Joined: Tue May 29, 2007 3:14 am
Posts: 28
Is it possible to update all loaded objects with the same ID as a saved object? I want so save an object, the object is loaded several times in the session, if I save one object the other objects will not reload automatically and keep the old information.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 17, 2007 3:11 pm 
Beginner
Beginner

Joined: Tue Sep 04, 2007 12:36 pm
Posts: 23
I believe this is the standard behavior of the first level cache.

If you load the same object multiple times within the same session, they are all references to one object.

If you load the same object in multiple sessions, well that is what the second level cache is for as I understand it.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 17, 2007 9:31 pm 
Regular
Regular

Joined: Fri Jan 20, 2006 7:45 pm
Posts: 97
Location: San Antonio, TX
If you call session.Refresh(theObject) it should refresh state from the cache if an instance is there, otherwise from the DB, thus loading it in the cache. You could call refresh before each use to ensure that they are in synch with the repository.

If this doesn't do it for you, could you be more specific regarding both what you are trying to to and what the current scenario is?

_________________
Dum spiro, spero
-------------------------------
Rate my post if it helps...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 27, 2007 7:24 am 
Beginner
Beginner

Joined: Tue May 29, 2007 3:14 am
Posts: 28
Hmm, maybe I should describe the circumstance, because this is not what I'm looking for.

In my program I have a class "Variable". With the objects of this class I do several calculations. One Variable can also be an computed value, (VariableComplete.Value = Variable1.Value + Variable2.Value). If now Variable1.Value changes, all Variables using this one have to be refreshed (e.g. VariableComplete), because the value of each variable will be computed only one time, saved in a property, and than used on and on...

I've no Idea how I could handle this. To update all objects of Variable1 will not help...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.