nHibernate HQL dynamic Instantiation question
- by Rey
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?