Python で次のアプリ エンジン モデルを検討してください。
class Account(ndb.Model):
email = ndb.StringProperty()
nickname = ndb.StringProperty()
phone = ndb.IntegerProperty()
date = ndb.DateTimeProperty(auto_now_add=True)
class Invitation(ndb.Model):
sender = ndb.StructuredProperty(Account, required=True)
recipient = ndb.StructuredProperty(Account, required=True)
message = ndb.StringProperty()
date = ndb.DateTimeProperty(auto_now_add=True)
@classmethod
def get_recipient(cls, sender, date):
qry = Invitation.query(ndb.AND(Invitation.sender == sender, Invitation.date == date)).fetch(projection=['recipient']))
return qry
上記のコードをJavaでどのように書き直しますか? Account は適切なエンティティ/モデルであることに注意してください。Java のEmbeddedEntity
. また、返信が JDO (コードを提供してください) の場合、Google サイトには次のような警告が表示されます(これはわかりません)。
ポリモーフィック クエリ。クラスのクエリを実行してサブクラスのインスタンスを取得することはできません。各クラスは、データストア内の個別のエンティティの種類によって表されます。
この警告は、app-engine の Java では実行できないことを Python で実行できることを意味しますか?