Objectify LoadException(将 V4.1.3 升级到 V5 后)预期 属性 值但发现...

Objectify LoadException (after upgrading V4.1.3 to V5) Expected property value but found...

我有一个带有嵌入式实体的实体。

@Entity @Cache public class UserOFY implements Serializable {
     @Id @Index private Long id;        
     @Unindex public LessonScheduleOFY lessonSchedule;
}

@Entity public class LessonScheduleOFY implements IsSerializable, Serializable {
     @Id @Index private Long id;

}

在 Objectify V4.1.3 中,如果我用 @Embed 标记 LessonScheduleOFY,它工作正常。

   @Embed @Entity public class LessonScheduleOFY implements IsSerializable, Serializable {
         @Id @Index private Long id;
    }

当我尝试升级到 V5 时,我 运行 ofy().factory().setSaveWithNewEmbedFormat(true);

然后加载我的 UserOFY 个实体,并保存 LessonScheduleOFY 个实体以及 UserOFY 个实体。

但是,当我更改为 V5(从我的 class 路径中删除 V4)并删除 @Embed 标记时,我收到错误消息:

Caused by: com.googlecode.objectify.LoadException: Error loading UserOFY(19001): At path 'lessonSchedule': Expected property value but found: {reviewing={true}, index={1}, completedLessons={}, timesAllCompleted={0}, ongoingReviewSchedule={}, revScheduleQueueResetSize={4}, ongoingReviewStats={}, id={19001}, reviewScheduleQueue={}, reviewSchedule={}, lessonSchedule=[{911}, {912}, {2676}, {2681}, {2696}, {2699}, {2700}, {12001}, {14001}, {17001}, {4644337115725824}, {4785074604081152}, {5207287069147136}, {5348024557502464}, {5910974510923776}, {6192449487634432}, {6333186975989760}, {5488762045857792}, {6614661952700416}], nextScheduledLesson={912}, completedLessonDate={}, READY_TO_ADVANCE={true}}

问题:

1) @com.googlecode.objectify.annotation.Serialize private HashMap<Long, Long> completedLessonDate; 之类的东西不能在 V5 的嵌入式 class 中使用吗?

2) 如果我找不到将 LessonScheduleOFY 用作嵌入式 class 的方法,我该如何将其迁移到它自己的实体?使用 Ref<?>s 和@Load?建立关系?

嵌入式实体没有需要的 @Id 注释。

我采纳了 StickFigure 的建议(在下面的评论中)并简单地删除了 @Entity 和 @Id 注释。