appengine - java persistent

时间:2009-05-12 10:43:44

标签: java google-app-engine persistent

我有三个关系类:

  • 会员1-n追踪器
  • Link 1-n Tracker

拥有一对多的双向关系

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Member {
        @PrimaryKey
        @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        private Key key;

        @Persistent(mappedBy = "member")
        private List<Tracker> trackers;

}

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Link {
        @PrimaryKey
        @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        private Key key;

        @Persistent(mappedBy = "link")
        private List<Tracker> trackers;

}

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Tracker {
        @PrimaryKey
        @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        private Key key;

        @Persistent
        private Member member;

        @Persistent
        private Link link;

} 

我创建了一个新的跟踪器:

member = new Member();
member.name = "blah";

link = new Link();
link.url = "http://blahblah.blah";

tracker = new Tracker();
tracker.setMember(member);
tracker.setLink(link);

pm.makePersistent(tracker);//error

它抛出

The class "The class "zodpob.model.Tracker" is not persistable. This
means that it either hasnt been enhanced, or that the enhanced version
of the file is not in the CLASSPATH (or is hidden by an unenhanced
version), or the Meta-Data/annotations for the class are not found."
is not persistable. This means that it either hasnt been enhanced, or
that the enhanced version of the file is not in the CLASSPATH (or is
hidden by an unenhanced version), or the Meta-Data for the class is
not found.

什么是“增强”是什么意思?

如果我坚持一个没有关系的课程,那就很好了

1 个答案:

答案 0 :(得分:2)

确保您使用的是DataNucleus插件....

这是他们的网站......

link text

...这是如何将它安装到Eclipse IDE ...

link text

...这是与JDO一起使用它的啧啧......

link text

我希望有所帮助,祝你好运。