-->
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: question about refresh
PostPosted: Wed Oct 25, 2006 10:58 am 
Senior
Senior

Joined: Sun Jun 11, 2006 10:41 am
Posts: 164
Hi all,
Do I need to call evict before every call to refresh? I've noticed that otherwise, refresh doesn't do anything...

thanks.

ps. I'm using hib3.1


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 25, 2006 2:19 pm 
Beginner
Beginner

Joined: Mon Nov 29, 2004 5:34 pm
Posts: 35
Hi,

I am not getting your requirement clearly.

but you use evict for

<--Text from Hibernate docs
Quote:

Whenever you pass an object to save(), update() or saveOrUpdate() and whenever you retrieve an object using load(), get(), list(), iterate() or scroll(), that object is added to the internal cache of the Session.

When flush() is subsequently called, the state of that object will be synchronized with the database. If you do not want this synchronization to occur or if you are processing a huge number of objects and need to manage memory efficiently, the evict() method may be used to remove the object and its collections from the first-level cache.

-->

evict is to remove object from first level cache. Are you try to do that?

_________________
My Forte 4GL and Spring Blog

srigold


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 26, 2006 5:41 am 
Senior
Senior

Joined: Mon Oct 23, 2006 5:12 am
Posts: 141
Location: Galicia, Spain
Hi.

I've tried session.refresh() and it works OK by itself (without calling evict()).

Check "automatic" session flushing before some SQL queries is not confusing you...

By the way, my hibernate.cfg.xml:

...
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>

<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

...

Hope this helps...

_________________
andresgr (--don't forget to rate)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 30, 2006 5:01 am 
Senior
Senior

Joined: Sun Jun 11, 2006 10:41 am
Posts: 164
I've written a response and it's gone.. Anyway, I'll try to be a bit more specific about my problem:

I keep refreshing a Server object, which has a <map> collection of Component objects. Each component has a unique name, which is used as the map key. However, this is NOT the component id.

If I change the NAME of a component outside my app:
comp.setName("new name")
And later on, then I refresh the Server in my app:
session.refresh(server)
This is what I see in the server's component map:
OLD name=reference to component with the NEW name

Doesn't matter what I do - I cannot get the collection to change the mapping from "OLD name" to "NEW name"...

Any ideas??


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.