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: selecting parameters into a map?
PostPosted: Wed Feb 25, 2009 3:33 pm 
Senior
Senior

Joined: Tue Aug 01, 2006 9:24 pm
Posts: 120
Hibernate version: 3.0

I am wondering if there is any way to do a select statement into a map.

For instance if I have an hql statement like this

Select a.pkId as aId, b.pkId as bId, c.pkId as cId
FROM tableA a
JOIN a.tableB b
JOIN b.tableC c

So that I would end up with a map that looks like
aId=1
bId=34
cId=6

It looks like I might have to just make sure I set the map up right after the call to the database. But it would be great if there was some kinda of utility or function that would do this.


thanks for any help.

_________________
Please rate my replies as I need points for all of my questions also.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2009 7:18 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Try something like this:

Code:
select new map(a.pkId as aId, b.pkId as bId, c.pkId as cId) from ....


And check the last example in this document: http://www.hibernate.org/hib_docs/v3/re ... elect.html


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2009 8:33 pm 
Senior
Senior

Joined: Tue Aug 01, 2006 9:24 pm
Posts: 120
Thanks that's what I was looking for.

I'll give it a try tommorrow.

_________________
Please rate my replies as I need points for all of my questions also.


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.