使用子实体的默认提取组是否必然意味着 App Engine 上的非法加入?

发布于 2024-09-24 02:09:04 字数 740 浏览 0 评论 0原文

我尝试向我的 User 类添加一个属性,以使其自动加载其子记录 (contacts)。

根据下面的错误,这似乎不可能,至少我尝试这样做的方式是这样:

 @Persistent(mappedBy = "user", defaultFetchGroup="true")
    private List<Contact> contacts;


WARNING: Meta-data warning for com.contactly.User.contacts: The datastore does not support joins and therefore cannot honor requ
ests to place related objects in the default fetch group.  The field will be fetched lazily on first access.  You can modify this warn
ing by setting the datanucleus.appengine.ignorableMetaDataBehavior property in your config.  A value of NONE will silence the warning.
  A value of ERROR will turn the warning into an exception.

Is there any other way to do this in JDO?

I tried to add a property to my User class to get it to automatically load its child records (contacts).

According to the error below, this doesn't seem possible, at least the way I tried to do it:

 @Persistent(mappedBy = "user", defaultFetchGroup="true")
    private List<Contact> contacts;


WARNING: Meta-data warning for com.contactly.User.contacts: The datastore does not support joins and therefore cannot honor requ
ests to place related objects in the default fetch group.  The field will be fetched lazily on first access.  You can modify this warn
ing by setting the datanucleus.appengine.ignorableMetaDataBehavior property in your config.  A value of NONE will silence the warning.
  A value of ERROR will turn the warning into an exception.

Is there any other way to do this in JDO?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

温柔嚣张 2024-10-01 02:09:05

您是否考虑过在 PM 获取计划上设置最大获取深度:pm.getFetchPlan().setMaxFetchDepth(int)?

  • 该值指定距离
    根对象 相关对象
    将被获取。正值
    意味着这个数
    关系将从
    根对象。值为 -1 意味着
    不会对
    抓取遍历。

您还可以在元数据中设置递归深度,但我还没有尝试过。

更多信息请参见:http://www.datanucleus.org/products/accessplatform/jdo /fetchgroup.html

Have you looked at setting the max fetch depth on the PM fetch plan: pm.getFetchPlan().setMaxFetchDepth(int)?

  • This value specifies how far out from
    the root object the related objects
    will be fetched. A positive value
    means that this number of
    relationships will be traversed from
    the root object. A value of -1 means
    that no limit will be placed on the
    fetching traversal.

You can also set a recursion-depth in the meta-data but I haven't tried that.

More info here: http://www.datanucleus.org/products/accessplatform/jdo/fetchgroup.html

╰ゝ天使的微笑 2024-10-01 02:09:04

不可以。App Engine 数据存储区不支持在加载查询结果的同时加载引用的实体。

No. The App Engine datastore doesn't support loading referenced entities at the same time as the results of a query.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文