I have a basic console application in which i using NHibernate V2.x to learn it. It is configured with FluentHibernate. I am facing a strange exception when executing the hql query to get all the users from user table. I know that user is reserved keyword,
so i tried
SELECT * FROM [User] and it worked good with
CreateSqlQuery method but then below failed miserably with the exception
Method 'HasAncestor' in type 'NHibernate.Hql.Ast.ANTLR.Tree.ASTNode' from assembly 'NHibernate, Version=184.108.40.20600, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' does not have an implementation.
which is also referred here. Below is all that i have in my console application, could you point out what is wrong
ISessionFactory factory = CreateSessionFactory();
//read using HQL the 500 users
using (ISession dbSession = factory.OpenSession())
var users = dbSession.CreateQuery("from user").List();
Dropbox Link to Solution ( Source + Database + Configuration ]
note: Please do change your database connections inside the code
I would almost for sure say, that this is the lower/upper case issue. The HQL parser (the ANTLR engine) results in case sensitive statements. Because, in C# we use Pascal style for Class names, I would say that your class is User.
HQL is working on top of Entity/C# model. So this should/must be working:
var users = dbSession.CreateQuery("from User").List(); // U is in capital