-->
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.  [ 3 posts ] 
Author Message
 Post subject: how to get a set of objects from a list of object ids
PostPosted: Sat Oct 04, 2003 8:24 pm 
Regular
Regular

Joined: Tue Aug 26, 2003 6:59 pm
Posts: 89
Location: Somewhere in the Ghetto
I've got a List of Object IDs and need to get Objects for all those Object IDs, below is what im using now, is there a way to do this using HQL?

ii = ageLimits.iterator();
while (ii.hasNext()) {
AgeLimit ageLimit = AgeLimitManager.getAgeLimit(new Long(ii.next().toString()));
productionCrew.getAgeLimits().add(ageLimit);
}


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 04, 2003 11:22 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
HQL will return you a list, but you can then appropriately apply the list to a set:
Code:
Query query = session.createQuery("from AgeLimit as a where a.id IN (:idList)");
query.setParameterList("idList",ageLimits);
productionCrew.getAgeLimits().addAll(query.list());


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 05, 2003 12:33 am 
Regular
Regular

Joined: Tue Aug 26, 2003 6:59 pm
Posts: 89
Location: Somewhere in the Ghetto
excellent, thanks!


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