nHibernate HQL dynamic Instantiation question
Posted
by Rey
on Stack Overflow
See other posts from Stack Overflow
or by Rey
Published on 2010-04-20T21:55:26Z
Indexed on
2010/04/20
22:33 UTC
Read the original article
Hit count: 366
Hello all, I can't find what's going on with the following nHibernate HQL.
here's my VB.Net code:
Return _Session.GetNamedQuery("PersonAnthroSummary").SetInt32(0, 2).UniqueResult()
My Named Query:
<sql-query name="PersonAnthroSummary">
select New PersonAnthroSummary( Anthro.Height, Anthro.Weight ) from PersonAnthroContact as Anthro where Anthro.ID = ?
</sql-query>
and i am importing the DTO class:
<import class="xxxxxxx.DataServices.PersonAnthroSummary, xxxxxxxxx.DataServices"/>
PersonAnthroSummary has a constructor that will take height and weight arguments.
when i test this, nHibernate throwing following exception:
{"Incorrect syntax near 'Anthro'."}
and generated QueryString is:
"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?
© Stack Overflow or respective owner