Creating query from string raise an error
Description
Environment
None
Activity
Show:

Alex Zaytsev February 26, 2013 at 9:36 AM
Won't fix as 2.1.2 is not supported anymore and classic parser solved the problem

Alexei Malashkevich February 26, 2013 at 7:17 AM
Thank you. It resolved my issue.

Alex Zaytsev February 20, 2013 at 8:56 PM
You can use classic HQL parser prior to NH 3.3.x (in vNext will be removed - NH-3344).
Add following to your NHibernate configuration
<property name = "hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
Won't Fix
Details
Details
Assignee

Reporter

Labels
Components
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created February 20, 2013 at 2:29 PM
Updated February 26, 2013 at 9:36 AM
Resolved February 26, 2013 at 9:36 AM
Who's Looking?
I move from Nhibernate 1.2 to 2.1.2.4000 and have following issue:
previously this code works perfect
String hql = @"SELECT new CurrentOrder(o1.Order, o1.User)
FROM OrderStatusChange o1 WHERE o1.Status.Id != :completed AND o1.CreatedDate =
(SELECT max(o2.CreatedDate) FROM OrderStatusChange o2 WHERE o2.Order.Id = o1.Order.Id GROUP BY o2.Order.Id)";
using (ISession session = SessionManager.Current.OpenSession())
{
IQuery query = session.CreateQuery(hql + CreateFilterString(filter));
query.SetInt64("completed", (long)OrderStatusEnum.ReportedComplete);
IList<CurrentOrder> result = query.List<CurrentOrder>();
return result;
}
But now it fails when calling method session.CreateQuery()
part of stack trace:
[TypeLoadException: Method 'HasAncestor' in type 'NHibernate.Hql.Ast.ANTLR.Tree.ASTNode' from assembly 'NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' does not have an implementation.]
NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.DoCompile(IDictionary`2 replacements, Boolean shallow, String collectionRole) +0
NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.Compile(IDictionary`2 replacements, Boolean shallow) +13
NHibernate.Engine.Query.HQLQueryPlan..ctor(String hql, String collectionRole, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) +313
NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(String queryString, Boolean shallow, IDictionary`2 enabledFilters) +185
NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(String query, Boolean shallow) +153
NHibernate.Impl.AbstractSessionImpl.CreateQuery(String queryString) +138