Before talking about the problem here's some background:
- There are 3 assemblies.
- One containing an Entity class and the problem HQL.
- Tests.
- Website.
- All the tests in the Tests assembly for are passing for the HQL.
- The exception is thrown in the website.
- If I use the equivalent Criteria code it works fine in all assemblies calling it.
Onto the problem. When calling the following HQL
var commentCount =
session.CreateQuery("select e.CommentCount from Entity e where e.Id = :entityId")
.SetParameter("entityId", string.Format("{0}:{1}", entityType, entityId))
.UniqueResult<int>();
this exception is thrown:
Entity is not mapped [select e.CommentCount from Entity e where e.Id = :entityId]
As mentioned I can just change to using Criteria, but I'm worried there might be an underlying problem that the use of Criteria is covering up.
Any ideas? Thanks.