Was getting strange error ' No Persister for System.String' when doing HQL query using a parameter.
Turned out it was because I was using SetEntity to assign the parameter value instead of SetString
All because of cutting and pasting!
This blog is a record of some development issues I have faced. There may be something of use!
Was getting strange error ' No Persister for System.String' when doing HQL query using a parameter.
Turned out it was because I was using SetEntity to assign the parameter value instead of SetString
All because of cutting and pasting!
If you have a class that maps to a table and a property of the class is an association to another table (i.e. 1:M Property) you may get the following error if the property is defined as an interface type:
NHibernate An association from the table XYZ refers to an unmapped class
This occurs because NHibernate will not have a mapping file for the interface type and cannot instantiate it because it is an interface. To fix the problem you need to include in the mapping file the actual class the property represents.
e.g.
IAccount MainAccount;
may map to
<many-to-one name="MainAccount" column="MainAccountID" class="BankingCore.BusinessEntities.Account, BankingCore"/>
where BankingCore.BusinessEntities.Account is the actual class to be instantiated for the property.
If you get
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.