-->
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: How to refresh a collection?
PostPosted: Fri Mar 16, 2007 7:16 am 
Newbie

Joined: Mon Jan 22, 2007 3:45 pm
Posts: 9
Hi,

how to refresh a collection of an entity? I have an entity which has many collections. and I don't want to refresh the whole entity (to avoid unnecessary DB traffic) but only one collection. The Session.refresh() method only accepts an entity and not a collection.

Is there a solution?

Regards, Markus


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 16, 2007 9:36 am 
Expert
Expert

Joined: Thu Sep 04, 2003 8:23 am
Posts: 368
Don't know what's your usecase but you can evict your object and reload it with an hql query that only join fetch the collection you want

_________________
Seb
(Please don't forget to give credits if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 16, 2007 1:53 pm 
Newbie

Joined: Mon Jan 22, 2007 3:45 pm
Posts: 9
Thanks for your reply but I do not want to evict the root object because I need the data. I can refresh the whole root object, but this refreshes all associated data.

I want to refresh only one collection to avoid unnecessary db access...

Regards


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 16, 2007 6:27 pm 
Senior
Senior

Joined: Sun Jun 04, 2006 1:58 am
Posts: 136
baeurlem wrote:
Thanks for your reply but I do not want to evict the root object because I need the data. I can refresh the whole root object, but this refreshes all associated data.

I want to refresh only one collection to avoid unnecessary db access...

Regards


It doest refresh all the data .. only the ones with cascade refresh option set ...

_________________
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.  [ 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.