2
我试着在谷歌应用程序引擎上的对象化(版本2.2.3)嵌入类示例(wiki)。我得到这个错误:objectify-appengine - 嵌入式类 - 不是受支持的属性类型
java.lang.IllegalArgumentException: one: com.mypkg.LevelOne is not a supported property type. at com.google.appengine.api.datastore.DataTypeUtils.checkSupportedSingleValue(DataTypeUtils.java:184)
我有的代码是一样的维基。在控制器中的部分:
EntityWithEmbedded ent = new EntityWithEmbedded(); ent.one = new LevelOne(); ent.one.foo = "Foo Value"; ent.one.two = new LevelTwo(); ent.one.two.bar = "Bar Value";
的EntityWithEmbedded类:
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 }
类LEVELONE:
import javax.persistence.Embedded; public class LevelOne { public String foo; public @Embedded LevelTwo two; //getter & setters here }
类LevelTwo:
public class LevelTwo { public String bar; //getter & setters here }
因此,它是基本的实施例我正在尝试。任何想法缺少什么?
我已经在使用@Entity和@Id上LEVELONE和LevelTwo类尝试。我专门公开了这些字段,以避免获得者和制定者。 – Ravi 2011-03-25 04:36:08