Showing posts with label HQL. Show all posts
Showing posts with label HQL. Show all posts

Monday, 24 August 2009

NHibernate HQL Query : could not resolve property

If you get

could not resolve property: ID: of

error for a HQL query and you know the property exists and is spelt correctly check that the query parameters are defined correctly.

Had this problem when query text was:

 

..... TaskStatus:=status ....

 

The problem is that the colon is the wrong side of the equals, should be

 

..... TaskStatus=:status ....

 

Error is easy typo to make but had to spot.

Tuesday, 27 February 2007

HQL Query - as, in errors

Tried to do a simple query:
from Page page

returned error ..expected in...

Tried
from Page as page

return error ..unexpected token:as..

After an hour of frustration realised that the object in C# was not called Page (I had renamed this to SalecorePage as it classed with the asp.net class:page).

The use of the wrong name stemmed from performing the query in SQL Server then porting to HQL.