-->
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: Returning a map
PostPosted: Mon May 23, 2011 10:06 am 
Newbie

Joined: Tue Jul 07, 2009 12:33 pm
Posts: 5
Is there a way to return a map of selected fields in hibernate?

E.g.:

select type, name, version from devices where id = :deviceId

Would return:

Map<String,String> device;

So I could do:

String type = device.get("type");

Without having to map it into a class called Device.

?


Top
 Profile  
 
 Post subject: Re: Returning a map
PostPosted: Mon May 23, 2011 2:01 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
There is an example in the documentation about this, though I have never used it myself. See the last example (select new map) in section http://docs.jboss.org/hibernate/core/3. ... hql-select


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.