Tom Ziemer wrote:

a) If you send p to the server, your persistence layer will save it for
you and update the id-field, yet this is not visible in the object on
the client, this will force you to have an API like
         public Parent saveParent(Parent p);

or

public Long saveParent(Parent p);

which will return only the generated ID back to feed your POJO's setter.

b) even worse: Looking at the only child Bert: if you update it on the
client, e.g. rename it to "Ernie" (c.setName("Ernie")) this will have no
effect at all, since the object returned by saveParent() will have to no
link to the child object on the client. So you basically have to do
something like:
        p.getChildren().getAt(0).setName("Ernie");

The usual situation is that you either:

* save the child in it's own context and get back it's identifier as suggested above for Parent
* use an assigned identifier for the child
* save the object graph using cascades but in a shoot and forget manner.

hth,

Manos

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to