【问题标题】:Grails eager fetch doesn't retrieve all dataGrails eager fetch 不会检索所有数据
【发布时间】:2010-09-28 16:04:07
【问题描述】:

我有域类:

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

如果我将static fetchMode = [ items: 'eager' ] 留在原处,那么调用getItems() 只会返回大约10% 的项目。如果我删除了 fetchMode,那么getItems() 会返回所有项目。知道为什么 Eager fetch 会导致检索不到所有存储的数据吗?

【问题讨论】:

  • 请将您问题的答案分享为答案,然后接受答案,否则此问题将继续留在我们的“未回答问题”列表中。如果问题不再相关,请标记它以引起版主注意。

标签: hibernate grails


【解决方案1】:

根据grails.org,在 2011 年 2 月,这在 Grails 1.04 中被识别为 bug。截至 2012 年 7 月,该错误被列为已关闭,因此问题应该得到解决。

【讨论】:

  • 请参阅 this question 了解我为什么要回复旧帖子。
猜你喜欢
  • 1970-01-01
  • 2016-07-16
  • 1970-01-01
  • 2016-03-02
  • 2012-10-21
  • 1970-01-01
  • 1970-01-01
  • 2015-01-09
  • 2022-01-24
相关资源
最近更新 更多