We are in the process of upgrading from Nhibernate 3.1 to 3.2, and all
of our named parameter queries that previously worked do not work
anymore.

Here is the stack trace, and the hql query.

NHibernate.QueryParameterException: could not locate named parameter
[yearsToDisplay]
at
NHibernate.Engine.Query.ParameterMetadata.GetNamedParameterDescriptor(String
name)
in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Engine\Query
\ParameterMetadata.cs:line 53
at NHibernate.Impl.AbstractQueryImpl.DetermineType(String paramName,
Object paramValue)
in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl
\AbstractQueryImpl.cs:line 151
at NHibernate.Impl.AbstractQueryImpl.SetParameterList(String name,
IEnumerable vals)
in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl
\AbstractQueryImpl.cs:line 733
at MVI.Facade.RetailerFacade.GetListWithSales(Int32[] years)


        public IList GetListWithSales(params int[] years)
        {
            //r.class is the retailer discriminator property, value of
0 is a retailer
            string hql =
            @" from Retailer r where r.class = 0 and r.id in
            (select distinct D.RetailerId from SalesData D where
D.Year in (:yearsToDisplay) ) order by r.Name";

            IQuery query = Session.CreateQuery(hql);
            query = query.SetParameterList("yearsToDisplay", years);

            return this.BeforeReturn(query.List());
        }

This function worked perfectly well before the 3.2 upgrade. All of our
other named query functions are not working as well, with the same
error message. Is it a configuration that I might be missing?

This is driving me crazy, as I can find no other people who seem to be
having this issue.

Thanks

Eric

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to