Just to follow up on a reply from Howard to the Tapestry list, it seems
the easiest way is to implement an Immutable adaptor for the
CayenneDataObject class, so that it isn't serialized/deserialized. I'm
reasonably confident that this is correct behaviour... we want exactly
the same object hanging around from one place to the next, and if
anything chagnes in it, then new pages *should* see the changes. In
fact, in the Tapestry 2.4 environment, it's essential, as I believe
Cayenne kind of relies on objects being unique within a
DataContext/OBjectStore. If Tapestry copies them and gives each Page
it's own copy, you'll end up seeing fragmentation of values as one page
edits one copy, then another edits another... arrghhhhh.
So, to summarise, I believe that the following is necessary:
Create your own subclass of DefaultValuePersister, and in the initialize
method register and instance of ImmutableValueCopier for
CayenneDataObject:
public class CayenneFriendlyValuePersister extends DefaultValuePersister
{
public void initialize(IRequestCycle) {
this.registerValueCopier(CayenneDataObject.class, new
ImmutableValueCopier());
}
}
NB: Code has not been compiled, nor tested. I don't have Tap2.4, and
don't have the time to find it, download, compile, fiddle, just yet.
Sorry 'bout that.
Then you need to use the extension point to install your Persister class
(something along the lines of including the extension tag in your
application specification.. I haven't been near that sort of thing yet
so won't say anything more that might be misleading :-)).
I'd be interested to see if this works....David?
Craig
This archive was generated by hypermail 2.0.0 : Wed Feb 19 2003 - 19:17:55 EST