我有 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.
“增强”是什么意思?
如果我坚持一个没有关系的班级,那就很好了