Description
I am upgrading my application making use of Nhibernate 5.0.3 to Nhibernate 5.3.6. I had to update deprecated eager loads, use updated GetCurrentTransaction method and everything seems to work except one UNIT TEST. Here is the exception the code is throwing when it tries to run a HQL delete statement.
Antlr.Runtime.NoViableAltException : A recognition error occurred.
at NHibernate.Hql.Ast.ANTLR.ErrorCounter.ThrowQueryException()
at NHibernate.Hql.Ast.ANTLR.Exec.BasicExecutor..ctor(IStatement statement, IQueryable persister)
at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.BuildAppropriateStatementExecutor(IStatement statement)
at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.DoCompile(IDictionary2 replacements, Boolean shallow, String collectionRole) at NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(IQueryExpression queryExpression, IASTNode ast, String queryIdentifier, String collectionRole, Boolean shallow, IDictionary
2 filters, ISessionFactoryImplementor factory)
at NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(IQueryExpression queryExpression, String collectionRole, Boolean shallow, IDictionary2 filters, ISessionFactoryImplementor factory) at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow, IDictionary
2 enabledFilters)
at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow)
at NHibernate.Impl.AbstractSessionImpl.CreateQuery(String queryString)
DomainModel\NHibernateHelper.cs(243,0): at CommerceBuilder.DomainModel.NHibernateHelper.CreateQuery(String query)
Products\ProductVariantManager.cs(237,0): at CommerceBuilder.Products.ProductVariantManager.ResetVariantGrid(Int32 productId)
Repositories\ProductOptionRepositoryTests.cs(58,0): at CommerceBuilder.Tests.Repositories.ProductOptionRepositoryTests.CanDelete()
--NoViableAltException
at NHibernate.Hql.Ast.ANTLR.SqlGenerator.whereClauseExpr()
The statement which is failing is this
("delete from BasketItem where Product.Id = " + productId).ExecuteUpdate()
Product is mapped as many-to-on for BasketItem with not found mode set to ignore
<many-to-one name="Product" column="ProductId" class="CommerceBuilder.Products.Product,CommerceBuilder" not-found="ignore" />
Any idea what could be the problem?