Hello
I'm experiencing something which made me wonder how lifecycle callback
work. Let me lay down an example first:
on rop client create two objects and link them together:
artist = context.newObject(Artist.class);
painting = context.newObject(Painting.class);
painting.setArtist(artist);
artist.setFieldA(null);
context.commitChanges();
on server for both Artist and Painting postPersist() trigger is fired,
result of one of the triggers depends on the other one.
Artist postPersist() {
tempContext = getNewContext();
localArtist = tempContext.localObject(this);
artist.setFieldA("not null value");
tempContext.commitChanges();
}
Painting postPersist() {
getArtist().setPersistenceState(PersistentState.HOLLOW); //to
counteract localObject
if (getArtist().getFieldA() != null) {
logger.warn("it works!");
}
}
Now surprisingly this code works.
It assumes that the postPersist() on Painting is going to be invoked
after Artist. And this is what I see when I run this. But is there a way
of assuring the order of postPersist triggers ?
Marcin
PS I guess that using localObject in postPersist() is not a good
practice. I'll try to re-design this, but even then still the order of
the triggers will matter.
This archive was generated by hypermail 2.0.0 : Wed May 19 2010 - 04:18:39 UTC