-->
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: nHibernate HQL Dynamic Instantiation problem
PostPosted: Wed Apr 21, 2010 11:10 am 
Newbie

Joined: Tue Apr 20, 2010 11:13 pm
Posts: 2
Hello all,
I can't find what's going on with the following nHibernate HQL.

here's my VB.Net code:

Code:
Return _Session.GetNamedQuery("PersonAnthroSummary").SetInt32(0, 2).UniqueResult()


My Named Query:

Code:

    <query name="PersonAnthroSummary">
               select new PersonAnthroSummary( Anthro.Height, Anthro.Weight ) from PersonAnthroContact as Anthro where Anthro.ID = ?
      </query>

and i am importing the DTO class:

Code:
<import class="xxxxxxx.DataServices.PersonAnthroSummary, xxxxxxx.DataServices"/>

PersonAnthroSummary has a constructor that will take height and weight arguments.

when i test this, nHibernate throwing following exception:

Quote:
"Errors in named queries: {PersonAnthroSummary}"

and generated QueryString is:

Code:
"select New PersonAnthroSummary( Anthro.Height, Anthro.Weight ) from PersonAnthroContact as Anthro where Anthro.ID = @p0"

Can some one tell me what i'm doing wrong here?.


Top
 Profile  
 
 Post subject: Re: nHibernate HQL Dynamic Instantiation problem
PostPosted: Wed Apr 21, 2010 5:51 pm 
Newbie

Joined: Tue Apr 20, 2010 11:13 pm
Posts: 2
Thanks to Orien, I figured it out. actual problem with my DTO class PersonAnthroSummary, which has a constructor that takes arguments of type decimal. but PersonAnthroContact mapping, those 2 columns mapped to dirrefent types. i changed PersonAnthroSummary constructor to take those types instead of decimals , then its working....


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.