NHibernate HQL could not locate named parameter [parameterName] error

hqlnhibernate

I am having problems with my HQL query bellow:

var merchantTransactions = session.CreateQuery("SELECT MS.Transaction "+
                                               "FROM MerchantSite AS MS "+
                                               "INNER JOIN MS.Transaction AS MST"+
                                               "WHERE MS.Site.Name = :merchantName");

Then I set parameters like this:

merchantTransactions.SetParameter("merchantName", merchantName);

And it gives me a "could not locate named parameter" error, any ideas why?

merchantName does exist in this context and all the table names are correct.

Best Answer

You are missing a space between MST and WHERE.

Related Topic