Ok I think I know what's going on.  First here's a stripped down version of
your object model with the bare minimum needed to reproduce the exception:

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

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

    @Persistent
    private List<RatePlan> ratePlans = new ArrayList<RatePlan>();
  }

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

    @Persistent
    private RatePlan ratePlan;

    public void setRatePlan(RatePlan ratePlan) {
      this.ratePlan = ratePlan;
    }
  }

And here's the unit test I turned your code into that generates the
exception:
  public void testBryce() {
    pm.newQuery(Activity.class).execute();

    Bundle bundle = new Bundle();
    bundle.setRatePlan(new RatePlan());

    pm.makePersistent(bundle);
  }

I believe the issue is that RatePlan is owned by two different objects in
your model - Bundle and Activity.  Due to the nature of primary keys in the
app engine datastore, a class can only have a single owner.  We detect other
flavors of this scenario when the entity meta-data is loaded but not this
particular variant.  I'll file a bug and try to produce a useful exception.
To work around this you'll need to either switch Activity.ratePlans or
Bundle.ratePlans to be an unowned relationship and just store the Key of the
RatePlan rather than the RatePlan itself.  Please give that a try and let me
know how it goes.

Thanks,
Max
On Tue, Dec 8, 2009 at 10:19 AM, bryce cottam <bcot...@gmail.com> wrote:

> No worries Max, I'm using 1.2.6 right now, so the "multiple instance" bug
> isn't an issue right now. Whenever you get to it is fine. As always I
> appreciate your input.
>
> Thanks
> -bryce
>
> On Dec 8, 2009 10:14 AM, "Max Ross (Google)" 
> <maxr+appeng...@google.com<maxr%2bappeng...@google.com>>
> wrote:
>
> Hi Bryce,
>
> I started digging into you issue and quickly bumped into the "Multiple
> relationships of the same type" bug for which I posted the workaround.  Then
> I got bogged down with unrelated stuff.  I have definite plans to get back
> to your example today.  Thanks for being patient, and sorry this is taking
> so long.
>
> Max
>
> On Mon, Dec 7, 2009 at 11:35 PM, bcottam <bcot...@gmail.com> wrote: > >
> Max, have you had a chance...
>
>  --
> 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
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>

--

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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.


Reply via email to