NHibernate.Hql.Ast.ANTLR.QuerySyntaxException

时间:2014-08-27 08:13:46

标签: c# .net linq nhibernate

我正在开发一个ASP.NET MVC 4项目,它包含了NHibernate 3.3。我有两个声明如下的类(简化为简洁):

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; }
}

并映射如下:

<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>

我得到了

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

我随时尝试通过linq查询nhibernate,例如:

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

我认为嵌套组件映射导致错误。有什么想法吗?

更新: 我决定,我应该首先更新所有引用的组件,所以我做了,刚刚从NuGet获得了最新版本的NHibernate和Npgsql,我仍然有例外,但现在有些不同了。我现在有:

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

0 个答案:

没有答案