-->
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: add ids to collection
PostPosted: Wed Nov 10, 2004 3:31 pm 
Newbie

Joined: Thu Sep 18, 2003 3:34 am
Posts: 9
Suppose there are two classes, A and B, 1-N related. I've loaded A object and want to add some B objects to collections. Data for these objects is in database, i know ids of these objects. is there any way to add them to the collection without loading all of them from DB?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 10, 2004 9:19 pm 
Beginner
Beginner

Joined: Sun Oct 03, 2004 8:50 am
Posts: 32
Location: McLean, VA
Not directly. You really only have a few options with collections. You can get them all, or you can define a static where clause that would be used to filter what gets put into the collection. This is great if you need something like "give me all the B's where last updated date was more than 60 days ago".

In most cases though you'll probably just need to execute some query to get whatever Bs you need.

_________________
- Chad


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.