Grails渴望获取不会检索所有数据 [英] Grails eager fetch doesn't retrieve all data

查看:82
本文介绍了Grails渴望获取不会检索所有数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有域类:

  class Person {
static hasMany = [items:Item]
static fetchMode = [items:'eager']
字符串名称
设置项目
}
class项目{
static belongsTo = [owner:Person]
字符串名称
}

如果我离开 static fetchMode = [items:'eager'] ,然后调用 getItems()只返回约10%的项目。如果我删除fetchMode,那么 getItems()会返回所有项目。任何想法为什么渴望获取结果检索少于所有的存储数据?

2011年2月,这已被确定为根据 grails.org ,在Grails 1.04中有bug 。截至2012年7月,该错误被列为已关闭,所以应该解决问题。

I have the domain classes:

class Person {
    static hasMany = [ items: Item ]
    static fetchMode = [ items: 'eager'  ]
    String name
    Set items
}
class Item {
    static belongsTo = [ owner: Person ]
    String name
}

If I leave static fetchMode = [ items: 'eager' ] in place, then calling getItems() only returns about 10% of the items. If I remove the fetchMode, then getItems() returns all the items. Any idea why eager fetch results in retrieving less than all the stored data?

解决方案

In February 2011, this had been identified as a bug in Grails 1.04, according to grails.org. As of July 2012, the bug is listed as closed, so the problem should be resolved.

这篇关于Grails渴望获取不会检索所有数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆