-->
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: Custom collection newbie
PostPosted: Sun May 11, 2008 10:19 pm 
Newbie

Joined: Sun May 11, 2008 9:59 pm
Posts: 1
Hi guys,

I've just started using NH last week, and I love it already! The first real problem I've faced is around custom collections. NH returns an IList of persisted entities, but in one situation I need an IList of fields from multiple tables. Since I need this list for read-only reporting function, it doesn't need lazy loading or persistence etc.

Eg:

select p.Name, 'Cash', p.Vehicle.Model from Person as p

The above query will return an IList of objects. Is there a simple way to have it return an IList collection of a custom class (say MemberList, with properties: Name, ModeOfPayment, VehicleModel)?

Maybe this is trivial, but I'm new to NH and still learning the tricks.

Thanks!


Top
 Profile  
 
 Post subject: Resulttransformer
PostPosted: Mon May 12, 2008 2:47 am 
Newbie

Joined: Sat Sep 22, 2007 5:42 am
Posts: 10
Hello!

Use .SetResultTransformer(Transformers.AliasToBean)

Regards


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.