-->
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: HQL "select new" error
PostPosted: Wed Feb 22, 2006 8:16 am 
Newbie

Joined: Sat Feb 11, 2006 12:11 pm
Posts: 7
Hello

I'm using a query to return certain fields from a select and I want the returned objects to be instances of "Tuplet1" class.
I get this exception: "class not found: Tuplet1" on query.List().

Here is the query:

Code:
SELECT new Tuplet1(P.Id, P.ProductName, P.UnitPrice, P.Category.CategoryName, P.Supplier.CompanyName)
FROM Product as P
WHERE P.Supplier.ContactTitle LIKE 'Sales%'      
ORDER BY P.Category.Id


The class Tuplet1 has the required constructor.
It is defined in the assembly where the query is created. I also tried defining this class in the assembly containing the domain model (the one with persisten classes and mapping files) that I used in Configuration - same error.

As a note, the query works fine if I don't use the "new" syntax.

How can I tell NHibernate where to find this Tuplet1 class?

Thanks in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 22, 2006 9:18 am 
Regular
Regular

Joined: Tue Mar 15, 2005 12:38 pm
Posts: 73
Location: Bucharest
Use
<import class="myasm.Tuplet1, myasm"/>

in one of you mapping files so that NH can find it!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 22, 2006 9:19 am 
Regular
Regular

Joined: Tue Mar 15, 2005 12:38 pm
Posts: 73
Location: Bucharest
Use
<import class="myasm.Tuplet1, myasm"/>

in one of you mapping files so that NH can find it!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 22, 2006 9:34 am 
Newbie

Joined: Sat Feb 11, 2006 12:11 pm
Posts: 7
Great! Thanks.


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.