-->
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 get the result as Map
PostPosted: Sat Aug 05, 2006 9:42 am 
Newbie

Joined: Tue Mar 21, 2006 4:19 am
Posts: 15
hi i have the following hql code
Code:
Query q = session.createQuery("select new map(c.code,c.name) from Countries c");

What code should I write to get the result as map?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 05, 2006 1:04 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
huh ? like any other way you would get results from a query.

either call .list or .iterate

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 05, 2006 8:26 pm 
Newbie

Joined: Tue Mar 21, 2006 4:19 am
Posts: 15
Then what does: "new map( )" ?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 05, 2006 11:29 pm 
Regular
Regular

Joined: Fri Oct 01, 2004 2:19 am
Posts: 111
Location: Melbourne, Australia
adr wrote:
Then what does: "new map( )" ?


presuming the 'new map(...)' portion in the call is valid (you may have meant Map()),
the result of the call to query.list() is a list of objects, each one of them is
a Map instance so a cast is required to get to the right type.

_________________
Cheers,

Bonny

please 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.