Discussion:
NHibernate 3.2 Named Parameter Errors
Eric
2011-10-11 14:35:43 UTC
Permalink
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 nhusers-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to nhusers+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
Fabio Maulo
2011-10-13 11:20:08 UTC
Permalink
Eric,
please create a new JIRA ticket attaching a very simple test or, at least,
some of your queries.
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/7lYiyGyTyckJ.
To post to this group, send email to nhusers-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to nhusers+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
ANIL ARORA
2017-08-02 05:52:38 UTC
Permalink
have you got the solution to your problem i am also facing the similar
issue.
Post by Eric
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 unsubscribe from this group and stop receiving emails from it, send an email to nhusers+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
Loading...