Hi,

I've found a way around this problem:

http://code.google.com/intl/fr-FR/appengine/docs/java/datastore/transactions.html

It says that you must assign the key of the new child by your own,
including the key of the parent.
So, before setting the child to his parent and saving it, first you
must do this:

      Graph graph = new Graph();
      String parentKey = indicatorPersisted.getCode();
      KeyFactory.Builder keyBuilder = new
KeyFactory.Builder(Indicator.class.getSimpleName(), parentKey);
      keyBuilder.addChild(Graph.class.getSimpleName(),
"graph"+parentKey);
      Key key = keyBuilder.getKey();
      graph.setId(key);

      indicatorPersited.setGraph(graph);

      pm.makePersistent(indicatorPersisted)

But i'm still not satisfied because it's not what JDO is supposed to
do on this own ????
I may be wrong, so let me know...someone? no? ^^

On 16 avr, 13:02, ckitop <cki...@gmail.com> wrote:
> Hi,
>
> Indeed,Ownedone-to-many relationship works perfectly in my test,
>
> the problem seems to be when attaching a new child (oneobject) to a
> parent which has already been saved (one-to-one)
> while attaching a new Collection to the same parent works fine (one-to-
> many)
>
> However, I'm also talking about a simple unidirectional relationships.
>
> On 16 avr, 10:34, ylmz <yilmazhuse...@gmail.com> wrote:
>
>
>
>
>
> > Hi, I am having the same problem and I found following post very
> > useful
>
> >http://groups.google.com/group/google-appengine-java/browse_thread/th...
>
> > it shows how to modifyone-to-many relationships.
>
> > On Apr 15, 1:07 pm, ckitop <cki...@gmail.com> wrote:
>
> > > Here, I've created a project that hosting the problem
>
> > >http://code.google.com/p/testjdo/source/browse/#svn/trunk/TestJDO
> > > -Appengine sdk 1.3.2
> > > -JUnit 3
>
> > > So, I made two unit tests to test:
> > >Ownedone-to-onerelationships
> > >Ownedone-to-many relationships
>
> > --
> > 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 
> > athttp://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 
> athttp://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