objectify ofy()。load()by String Id在本地工作,在appengine上抛出NotFoundException

时间:2018-02-12 07:46:05

标签: java google-app-engine objectify

我有以下实体:

public class Subscription {
    @Id
    String orderName;
        .....
    transient ArrayList<Long> plantsOrderIds;

    int qty;
    @Load
    transient Ref<SubscriptionPlan> subscriptionPlan;
        ......
        [Getters/ Setters] 
        ........
}

我有这个函数来通过orderName获得Subscription。

public Subscription getSubscription(String orderName) {
    return ofy().load().type(Subscription.class).id(orderName).safe();
}

Subscription sub = getSubscription("foo"); // returns the Subscription running locally, and throws NotFoundException when deployed on appengine.

我将函数更新为以下但仍然是相同的行为:

public Subscription getSubscription(String orderName) {
    Key<Subscription> key = Key.create(Subscription.class, orderName);
    return ofy().load().key(key).safe();
}

是什么原因引起了这个问题,或者我错过了什么?

0 个答案:

没有答案