1
1.-创建对象的id无法创建在app-发动机的新对象:重复主键(ID:长型)
// Allocate a key for the conference -- let App Engine allocate the ID
final Key<Conference> conferenceKey = factory().allocateId(profileKey, Conference.class);
// Get the Conference Id from the Key
final long conferenceId = conferenceKey.getId();
2.-创建objeto,添加ID
// Create Conference
Conference conference = new Conference(conferenceId,userId,conferenceForm);
3.-保存对象:
// Save Conference and Profile Entities
ofy().save().entities(profile,conference).now();
ofy().save().entity(conference).now();
4.-错误,使用相同的id倍数倍(数据存储区谷歌)
注:与同ANDROID_CLIENT_ID(释放模式)创建相同的对象
你所看到的是正确的,因为ID = 1的两个实体具有不同的父项,所以它们具有不同的密钥。这是唯一完整的关键路径 - 名称/ ID仅在其父范围内唯一。 – tx802
@ tx802 - 请发表评论作为回答。这是正确的。 –