【问题标题】:Syntax error on multi query in NHibernate 3 and MySQLNHibernate 3 和 MySQL 中的多查询语法错误
【发布时间】:2010-12-06 22:52:11
【问题描述】:

我曾经能够在 NHibernate 2.1 中使用 MySQL 将以下代码作为多查询运行

var total = new LeagueInfoQuery { Count = true, User = CurrentUser }.CreateCriteria(session).FutureValue<int>();
var leagues = new LeagueInfoQuery { User = CurrentUser, PageSize = pageSize, Page = page, SortBy = sortBy, SortAsc = sortAsc }.CreateCriteria(session).Future<LeagueInfo>();
var results = PaginationHelper.CreateCustomPage<LeagueInfo>(leagues, pageSize, page, total.Value);

例如在哪里LeagueInfoQuery 只是一个可以创建标准 ICriteria 的自定义查询对象。

但是,自从升级到 NHibernate 3.0 后,我现在遇到了语法错误。异常信息如下。

{"执行多条件时出错: [SELECT count(*) as y0_ FROM League this_ WHERE this_.User = ?p0;\r\n选择 this_.Id 为 y0_, this_.Name 为 y1_,min(f1_.Date) 为 y2_, max(f1_.Date) 作为 y3_, count(distinct t2_.Id) as y4_ FROM Leaguethis_内连接Teamt2_ 关于 this_.Id=t2_.League 内联 Fixture f1_ on this_.Id=f1_.League WHERE this_.User = ?p1 GROUP BY this_.Name ORDER BY y0_ desc 限制 ?p1;\r\n]"}

内部异常:

{"您的 SQL 中有错误 句法;检查手册 对应你的 MySQL 服务器 使用正确语法的版本 靠近 ''b68d9d4e-a958-4fb8-8490-9e4401572f38'' 在第 1 行"}

所以它看起来像一个语法错误,但这在 v2.1 中并没有发生,如果我在消息中编辑 SQL 以便参数是值,我可以让它工作。

那么为什么现在在 NHibernate 3.0 中会出现这个错误呢?我需要为 MySQL 语法配置一些特别的东西吗?如果需要,怎么办?

干杯。

【问题讨论】:

  • 如果您可以通过替换 NH 二进制文件来始终如一地重现该问题,请在 jira.nhforge.org 处打开一个问题
  • 好的,我会尽快完成,希望今晚 - 谢谢。
  • 我创建了一个附加项目的问题来演示它216.121.112.228/browse/NH-2450

标签: c# mysql nhibernate nhibernate-3


【解决方案1】:

这是 NHibernate 3 的问题,现在是 resolved(谢谢!)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-08-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-24
    • 1970-01-01
    • 2016-11-29
    相关资源
    最近更新 更多