I am trying out the objectify(version 2.2.3) embedded classes example (wiki) on google app engine. I am getting this error:
java.lang.IllegalArgumentException: one: com.mypkg.LevelOne is not a supported property type. at com.google.appengine.api.datastore.DataTypeUtils.checkSupportedSingleValue(DataTypeUtils.java:184)
The code I have is the same as the one in Wiki. The section in the controller:
EntityWithEmbedded ent = new EntityWithEmbedded(); ent.one = new LevelOne(); ent.one.foo = "Foo Value"; ent.one.two = new LevelTwo(); ent.one.two.bar = "Bar Value";
The EntityWithEmbedded class:
import javax.jdo.annotations.Embedded; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class EntityWithEmbedded { @Id public Long id; @Embedded public LevelOne one; //getter & setters here }
Class levelOne:
import javax.persistence.Embedded; public class LevelOne { public String foo; public @Embedded LevelTwo two; //getter & setters here }
Class LevelTwo:
public class LevelTwo { public String bar; //getter & setters here }
So it is the basic example that I am trying out. Any ideas on what is missing?
You're using the wrong @Embedded
annotation in EntityWithEmbedded
.
Use javax.persistence.Embedded
rather than javax.jdo.annotations.Embedded
来源:https://stackoverflow.com/questions/5428571/objectify-appengine-embedded-class-not-a-supported-property-type