appengine - java持久性
我有 3 个具有关系的类:
- 成员 1-n 跟踪器
- 1-n 跟踪器
链接具有拥有的一对多双向关系的
@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.
什么是“增强”意味着什么?
如果我坚持一个没有关系的课程,效果很好
I have 3 class with relation:
- Member 1-n Tracker
- Link 1-n Tracker
with owned one-to-many bidirectional relationship
@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;
}
I create a new tracker:
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
it throws
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.
what is "enhanced" mean?
if i persistent a class with no relation, it's work well
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保您使用的是 DataNucleus 插件...
这是他们的网站...
链接文本
。 ..以下是如何将其安装到 Eclipse IDE...
链接文本
...这里是与 JDO 一起使用它的教程...
链接文本
我希望有所帮助,祝你好运。
Make sure you're using the DataNucleus plugin....
Here is their site...
link text
...here is how to install it on to the Eclipse IDE...
link text
...and here is a tut for using it with JDO....
link text
I hope that helps and good luck.