I'm trying to embed a map in an entity with Objectify 4 (and GAE SDK 1.9.0).
The docs (here) show stuff like this:
@Embed
class LevelTwo {
String bar;
}
@Entity
class EntityWithEmbeddedCollection {
@Id Long id;
List<LevelOne> ones = new ArrayList<LevelOne>();
}
So first I tried to do the same thing but with a HashMap< Long, LevelTwo >. This resulted in a runtime error when I tried to save the entity.
Then I read about @EmbedMap, which is a recent addition to ofy. So then I tried the following formlation:
class LevelTwo {
Integer one;
Boolean bee;
}
class EntityWithEmbeddedCollection {
@Id Long id;
@EmbeddedMap
Map<Long, LevelTwo> ones = new HashMap<Long, LevelTwo>();
}
I also tried this with LevelTwo as an inner static class and a few other variations, but I always get:
com.googlecode.objectify.SaveException:
Error saving com.myapp.UserInfoSvr@96: items: java.util.HashMap is not a supported property type.
at com.googlecode.objectify.impl.Transmog.save(Transmog.java:105)
Any suggestions?