Hi all!

I'm trying to update some child objects to the datastore via
PersistenceManager, but my data is never updated/overrided when I use
makePersistent with such object directly. I need to do that in order
to avoid sending a whole entity via RPC, but to send just the child
object I need to update.

1. When I do something like saveMethod(parent), then the parent object
and the child are saved both.

2. Then, when I load the child and I try so save it again like:
    saveMethod(child) the method "saves" it correctly (no errors found
and returns true)

3. But when I try to reload the child, It has not being updated.

(See context above)

Aditionally, I want to delete some of these children, but It has been
imposible too, like this:

parent.removeChild(childIndex);//this removes the child from ArrayList
of children
saveMethod(parent);

But, when I reload parent, it stil has the "removed" child.

(Help me please!). Thanks a lot.

Magus.

==========================================================
Some context:

Classes:

@PersistenceCapable(identityType = IdentityType.APPLICATION,
detachable = "true")
public class Parent{

  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  private Key id;

  @Persistent(defaultFetchGroup = "true")
  private List<Child> children;
...
}

@PersistenceCapable(identityType = IdentityType.APPLICATION,
detachable = "true")
public class Child{

  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  @PrimaryKey
  private Key id;

  @Persistent
  private String field;
...

}

saveMethod:


public <T> boolean saveMethod(final T object) {

    PersistenceManager pm =
PersistenceManagerFactory.get().getPersistenceManager();

    try {
      pm.makePersistent(object);
      return true;
    } catch (Exception e) {
      return false;
    } finally {
      pm.close();
    }
  }



-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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-web-toolkit?hl=en.

Reply via email to