NHibernate.Hql.Ast.ANTLR.QuerySyntaxException

I am working on an ASP.NET MVC 4 project incorporating NHibernate 3.3. I have two classes declared as follows (simplified for brevity):

public class LocationReading { public long Timestamp { get; set; } public GeoLocation Location { get; set; } } public class GeoLocation { public double Latitude { get; set; } public double Longitude { get; set; } } public class RoutePoint { public virtual int Id { get; set; } public virtual string Username { get; set; } public virtual LocationReading LocationReading { get; set; } } 

and displayed as follows:

 <class name="RoutePoint"> <id name="Id" type="Int32" column="id" unsaved-value="0"> <generator class="hilo"/> </id> <property name="Username"/> <component name="LocationReading" > <property name="Timestamp"/> <component name="Location"> <property name="Latitude"/> <property name="Longitude"/> </component> </component> 

I get

 NHibernate.Hql.Ast.ANTLR.QuerySyntaxException: Exception of type 'Antlr.Runtime.MismatchedTreeNodeException' was thrown. 

At any time, I try to execute a query via linq for nhibernate, for example, for example:

 int count = session.Query<RoutePoint>().Where(p => p.LocationReading != null).Count(); 

I think nested component mapping is causing an error. Any ideas?

Update: I decided that I had to update all the referenced components first, so I made and received the latest versions of NHibernate and Npgsql from NuGet, and I still have an exception that is now slightly different. Now I have:

 NHibernate.Hql.Ast.ANTLR.QuerySyntaxException {"A recognition error occurred. [.Count[RoutePoint](.Where[RoutePoint](NHibernate.Linq.NhQueryable`1[RoutePoint], Quote((p, ) => (NotEqual(p.LocationReading, NULL))), ), )]"} 
+6
source share

Source: https://habr.com/ru/post/974409/


All Articles