Hi James,

thanks for your hint and pointer to the previous thread! There is
indeed a lot of odd behaviour in this that almost drove me crazy the
last couple of days. Where do you call the JDOHelper.makeDirty or does
it matter at all?

JDOHelper.makeDirty(myDetachedObject, "myArrayOfChildObjects");
pm = pmf.getPersistenceManager();
tx = pm.currentTransaction();
try {
    tx.begin();

    pm.makePersistent(myDetachedObject);

    tx.commit();
} finally {
    if (tx.isActive()) {
        tx.rollback();
    }
    pm.close();
}

I tried a few positions but it doesn't seem to solve my problem with
an array of child objects. It seems you had an array of Keys (stored
embedded) right?

Best,
Fred

On 2 Aug., 20:39, James <[email protected]> wrote:
> I asked about this a while back and never got a clear answer...  I
> just call JDOHelper.makeDirty a lot and things work, but this doesn't
> feel like the "right" thing to be doing.
>
> http://groups.google.com/group/google-appengine-java/browse_thread/th...
>
> On Aug 2, 6:11 am, Frederik Pfisterer <[email protected]> wrote:
>
> > Hi,
>
> > there seems to be something weird with how JDO handles modifications
> > (removes) to lists of objects.
> > I have two lists:
>
> >     @Persistent(defaultFetchGroup = "true")
> >     @Element(dependent = "true")
> >     private List<Child> dependentObjects = new ArrayList<Child>();
>
> >     @Persistent
> >     private List<String> stringListProperty = new ArrayList<String>();
>
> > Say both lists currently have two persisted entries. While when in
> > detached stade i can do this:
>
> > myObject.getStringListProperty().remove(0);
>
> > Once the object is persisted and retrieved again there is only one
> > entry in the list of strings. When i do the same thing with the list
> > of children it doesn't persist the changes:
>
> > myObject.getDependentObjects().remove(0);
>
> > After attaching and persisting myObject there will still be two
> > children in the list once it is retrieved at a later point.
>
> > I could not find the corresponding JDO datanucleus specification/
> > reference, but maybe someone can help and shed some light whether this
> > is desired. If needed i can post more code.
>
> > Thanks,
> > Fred

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