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

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

例如,EG loagueinfoquery只是一个可以创建标准iCriteria的自定义查询对象。

但是,由于升级到NHIBERNATE 3.0,我现在会出现语法错误。例外消息如下。

{“错误执行多标准:[select count(*)为y0_ Leaguethis_ where there_.user =?p0; r nselect this_.id as y0_,this_.name as y1_,min(f1_.date)as y2_,max(f1_.date)as y3_,y3_,y3_,count(dimstand t2_.id)如y4_ League this_内部加入 Team t2_ on this_.id = t2_.league内心加入 Fixture f1_ on this_.id = f1_.league在哪里this_.user =?p1组,由y0_ desc limit?p1; r n]“}

内部例外:

{“您在SQL语法中有一个错误;检查与您的MySQL Server版本相对应的手册,以供合适的语法使用''B68D9D4E-A958-4FB8-4FB8-8490-9E44444401572F38'在第1行1“}

因此,它看起来像是语法错误,但是在v2.1中并没有发生这种情况,如果我在消息中编辑了SQL,以便参数为值,我可以使其正常工作。

那么,为什么现在在NHIBERNATE 3.0中出现此错误?我是否需要为MySQL语法配置某些内容,如果是这样?

干杯。

有帮助吗?

解决方案

这是Nhibernate 3的问题,现在已经 解决 (谢谢!)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top