0
votes

I have an entity with an embedded entity.

@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;

}

In Objectify V4.1.3, if I tag the LessonScheduleOFY with @Embed, it works fine.

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

When I try to upgrade to V5, I run ofy().factory().setSaveWithNewEmbedFormat(true);

and then load my UserOFY entities, and save the LessonScheduleOFY entities as well as the UserOFY entities.

However, when I change to V5 (removing V4 from my classpath) and remove the @Embed tag, I get an error:

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}}

Questions:

1) can things like @com.googlecode.objectify.annotation.Serialize private HashMap<Long, Long> completedLessonDate; not be used in an embedded class in V5?

2) If I can't find a way to use LessonScheduleOFY as an embedded class anymore, how can I migrate it to it's own Entity? Use Ref<?>s and @Load? to form a Relationship?

1

1 Answers

0
votes

The embedded entity didn't have an @Id annotation which is needed.

I took StickFigure's advice (in comment below) and simply removed the @Entity and @Id annotations.