我有一个域名,有一个儿童游览。如果我通过巡演订购,结果的数量会发生变化
Location.withCriteria{
tour{
order('date')
}
}//will gives me fewer results than
Location.withCriteria{
order('name')
}
我尝试了各种方法来定义关系,使用belongsTo,hasOne,ect,但没有得到任何给出相同数量结果的东西。
使用“totalCount”获取分页的记录编号可能会导致差异。
records.totalCount
这会触发另一个自动生成的SQL查询,默认情况下可能使用内连接。如果原始标准使用hibernate's fetchMode.JOIN, it will use outer join by default。这可能会导致你没想到的差异..
解决方法是创建自己的计数查询。