Hello,

Thanks for your answer. My question was really to understand why the tests
included are failing. As far as I understand, there is no parent defined in
my Ranking entity, so I expect the Player to which it belongs to be created
when the Player is being persisted.

I have included the core of the test (the tests themselves, and the
annotated model objects).
-- 
seb

2011/7/8 Christopher Merrill <[email protected]>

> It is not clear (to me) exactly what question you are asking. Are you
> asking if it is possible to change the parent of a datastore entity
> after it has been created? AFAIK, the answer is no, because the parent
> is an inherent part of the identity of the entity...which also cannot
> be changed. You have to create a new entity with the new parent,
> delete the old, and update all references to the old entity to point
> at the new one.
>
> As far as your code example, many people (including myself) are not
> going to download and open a zip file from unknown sources.  You will
> get a better response by including the smallest possible code snippet
> that shows exactly the problem you are trying to solve.
>
> Chris
>
>
> 2011/7/7 Sébastien Tromp <[email protected]>:
> > Hello,
> > I have already posted this e-mail on the general AppEngine google group,
> but
> > without any answer; so I assume it may be better suited in the AppEngine
> for
> > Java group.
> > -----------
> > Hello,
> > First of all I'd like to apologize, because it seems that this question
> has
> > been asked several times already. I looked at them all, but unfortunately
> > couldn't find the answer to my issue.
> > I have put together the attached test case to illustrate my issue, but to
> > sum it up:
> > - I create a Player entity
> > - I create a Ranking entity
> > - I assign the Ranking to the Player
> > - I persist the player
> > And at that point the aforementioned exception is raised.
> > The attached test case contains all the details for the classes, and
> should
> > be self-sufficient provided the classpath is properly configured.
> > If, in my parent class (Player), when I set the child (Ranking), I do:
> > public void setRanking(final Ranking ranking) {
> >         this.ranking = ranking;
> >         ranking.setPlayer(this);
> >     }
> > all tests seem to pass, except for the last one. And it really looks like
> a
> > hack to me, so I'm not sure that's the way to go.
> > I'd be glad to give any additional information I may have forgotten, or
> > pointers to the documentation that explains what I did wrong (there is
> > obviously something I'm not getting here).
> > Thanks in advance for your help,
> > --
> > Seb
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine for Java" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/google-appengine-java/-/YIWXRkvgjs0J.
> > 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.
> >
>
> --
> 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.
>
>


-- 
Seb

-- 
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.

Attachment: Player.java
Description: Binary data

Attachment: Ranking.java
Description: Binary data

Attachment: TestBasicPersistence.java
Description: Binary data

Reply via email to