-->
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: query given list of object ids from different classes
PostPosted: Tue Jul 31, 2007 3:26 pm 
Newbie

Joined: Tue Jul 31, 2007 2:56 pm
Posts: 1
I have a list of object ids - the ids are for objects that are instances of different classes, but they all inherit from AbstractElement.

I want to get the AbstractElement.name property for each of these objects, but for performance reasons I do not want to iterate through the list, load the object, get the name property and put it in a map.

Is there a way to run a single query to get the name property of each of the objects?

i.e. given a list of object ids, get back a map of objectId/name.

Thanks


Top
 Profile  
 
 Post subject: HQL Query
PostPosted: Tue Jul 31, 2007 5:05 pm 
Newbie

Joined: Fri Apr 07, 2006 11:29 am
Posts: 17
I would create an operation in my DAO to get the specific property and return it as a list perhaps? HQL would be your best bet.

[code]
select o.stringProperty from ObjectExample o where o.id in (comma separated list of ids you want the stringProperty from)
[code]


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.