> I would like to use XMLEncoder's printProperty() methods and such, but
> at the same time, I'd like to change the output format a bit. I
> assume I should just tack on new things rather than change existing
> functionality, but that's going to make for a grotesque API. Any
> thoughts here?
Not quiet sure what changes you are planning here, but if you need to
change existing Cayenne API, propose your suggestions as a patch (and make
sure you deprecate and leave around the old methods if method signiture
changes).
> One thing came up when encoding one of my data objects using
> java.beans.XMLEncoder, however.
I wonder if java.beans.XMLEncoder is appropriate to use in Cayenne...
DataObjects are JavaBeans in most respects, but DataContext, ObjectId,
etc. are not.
I assume the trace below coming from Decoder (as encoder shouldn't call
set* methods)?
> java.lang.InstantiationException: org.objectstyle.cayenne.ObjectId
> java.lang.RuntimeException: failed to evaluate:
> <unbound>=ObjectId.new();
ObjectId doesn't have a default noarg constructor and is not intended to
be a mutable "bean". Not sure how to work around this...
> java.lang.Exception: discarding statement User0.setUsername("nirvdrum");
.....
> org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2-dev December 9
> 2004] Cannot set object as destination of relationship createdBy
> because it is in a different DataContext
There is probably an absense of DataContext on deserialization issue...
objects have to be "bootstrapped" in the DataContext before their
properties can be set (esp. relationships) via set*
Actually some time back we discussed with Eric Schneider whether
"context-less" relationships and properties support would make sense (and
also related feature of persistence by reachability - adding transient
objects to a DataContext of persisten object when a relationship is
established)... Maybe this is a good time to implement it? We could start
with a JIRA issue I guess, as introduction of such feature affects general
design...
Andrus
This archive was generated by hypermail 2.0.0 : Fri Dec 10 2004 - 11:08:14 EST