On 7/22/06, Andrus Adamchik <[EMAIL PROTECTED]> wrote:
I see. That makes sense - each DataContext in a nested context chain
would create its own instance of object and transition it through the
lifecycle. So technically it is still called once per object
instance. However the fact that ID can be passed from a peer object
in the upstream context requires an extra check. E.g.:
public void setPersistenceState(int state) {
super.setPersistenceState(state);
if (state == PersistenceState.NEW && getObjectId() == null) {
setId(UUID.randomUUID());
}
}
That didn't work for me. getObjectId() is never null when
setPersistanceState() is called, AFAICT.
Otherwise, it seems to work fine though.
--
Øyvind Harboe
http://www.zylin.com