-->
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: creating objects based on fields returned from query
PostPosted: Wed May 25, 2005 5:02 pm 
Newbie

Joined: Wed May 25, 2005 4:46 pm
Posts: 4
The following hql example is from the hibernate 2.0.3 doc:

select new Family(mother, mate, offspr)
from eg.DomesticCat as mother
join mother.mate as mate...

It seems to me that this statement will return collection of Family objects by constructing them using the fields returned from the query, but I cannot make this work for nhibernate, do I need to specify the assembly name of the class somewhere? do I need to create a mapping for the Family class? If I need to create a class it will be difficult because I use the class for reporting only therefore there is no mapping to the backend database.

When I'm trying to do is to use hql to construct "flattened" (or projected) report objects, is there another way to do that?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 25, 2005 5:41 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
You need to put <import name="Fully.Qualified.Family, SomeAssembly" /> in one of your mapping files.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 26, 2005 12:25 pm 
Beginner
Beginner

Joined: Wed Jun 08, 2005 4:59 pm
Posts: 27
sergey wrote:
You need to put <import name="Fully.Qualified.Family, SomeAssembly" /> in one of your mapping files.


So, in other words, it isnt possible to do arbitrary ad-hoc type reporting without first defining the result "row" as a class?

Is that the only way to code up reports with (N)Hibernate?

Thanks!
-Michael


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.