Hello Anna,

Have you tried something along these lines: have a link persistent
entity class (as a link "table"). Each instance of this class stores
the encoded (primary) key string of a related pair of Entity1 and
Entity2 instances? (This approach does not describe the entity parent-
child structure of all these entities.)

Example persistent entity class code follows.

Cheers,

Ian


@PersistenceCapable(identityType = IdentityType.APPLICATION,
 detachable = "true")
public class ManyToManyLink implements Serializable
{
  private static final long serialVersionUID = 1L;

  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  @Extension(vendorName="datanucleus", key="gae.encoded-pk",
value="true")
  private String sEncodedKey;

  @Persistent
  private String sEKEntity1;

  @Persistent
  private String sEKEntity2;
}

@PersistenceCapable(identityType = IdentityType.APPLICATION,
 detachable = "true")
public class Entity1 implements Serializable
{
  private static final long serialVersionUID = 1L;

  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  @Extension(vendorName="datanucleus", key="gae.encoded-pk",
value="true")
  private String sEncodedKey;
}

@PersistenceCapable(identityType = IdentityType.APPLICATION,
 detachable = "true")
public class Entity2 implements Serializable
{
  private static final long serialVersionUID = 1L;

  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  @Extension(vendorName="datanucleus", key="gae.encoded-pk",
value="true")
  private String sEncodedKey;
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to