views:

899

answers:

1

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

+2  A: 

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.

Randin