使用 JDO (Datanucleus) 急切地获取子项
JDO 可以一次获取数据库模型的所有子模型吗?
就像:
class Parent {
@Persistent(mappedBy="parent")
private Set<Children> children;
}
class Children {
@Persistent
private Parent parent;
@Persistent
private String name;
}
就我而言,我有大量的父母,我可以立即获取。然后访问他们的孩子需要花费很多时间,因为他们是懒惰地获取的。
JDO(Datanucleus)是否支持与父级一起立即获取?
我还尝试使用另一个查询独立地获取所有子项,然后将它们放入二级缓存中,但它们仍然被获取(也许jdo不知道它们的关系?因为ForeignKey(parent-id)尚未在首先?)
有什么想法可以更快地读取数据结构吗?
干杯,
简
Can JDO fetch all children of a database model at once?
Like:
class Parent {
@Persistent(mappedBy="parent")
private Set<Children> children;
}
class Children {
@Persistent
private Parent parent;
@Persistent
private String name;
}
In my case, I have a large number of parents which I fetch at once. Accessing their children then takes a lot of time because they are fetched lazily.
Does JDO (Datanucleus) support their fetching at once, togehter with the parents?
I also tried to fetch all children independantly with another query and put them into the Level2 cache afterwards, but still they are fetched (maybe jdo doesn't know about their relationship? Because the ForeignKey (parent-id) hasn't been fetched at first?)
Any ideas how to read the data structure faster?
Cheers,
Jan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否使用获取组?您的子类可能不在默认的获取组中。
Are you using Fetch Groups? Your Child classes are probably not in the default fetch group.