Joon,
the cause for your problem is missing support for the transient attribute on
the JDO side of things (http://bugzilla.exolab.org/show_bug.cgi?id=1210). I
am currently in the process of finishing coding, bug due to the pending 0.9.6
release, I am not able to dedicate as much time as wanted.
Can you please have a look at what's been discussed so far, and let us know
your opinion ?
Thanks
Werner
On Wed, 1 Dec 2004 10:57:46 -0800 (PST), Jon Wilmoth wrote:
>
>I have a JDO object that persists a number of fields.
>Two specific fields are timestamp data type fields
>"startDate" & "endDate". In addition to the persisted
>fields I have a java bean style method for retreiving
>a calculated value (public Double
>getCalculatedDurationHours() ...). This method
>calculates the difference between the start and end
>persistent fields. I'd like to marshall this object
>(using castor xml) to include the persistent fields
>plus this calculated field. I tried turning on
>"auto-extends" in the mapping document for this class,
>but got errors as Castor tried unsuccessfully
>marshalling constants (that I wouldn't want marshalled
>anyway). I then tried adding an explicite mapping for
>this "field", and added a dummy setter (public
>setCalculatedDurationHours(Double value){}) to avoid
>an error message saying there wasn't a setter for the
>mapped field.
>
><field name="calculatedDurationInHours" type="double"
>required="false">
><bind-xml name="calculatedDurationInHours"
>node="element" transient="false"/>
></field>
>
>Unfortunately this leads to the following error when
>the object is loaded:
>
>org.exolab.castor.jdo.DataObjectAccessException: Type
>conversion error: could not set value of FieldMolder
>of
>com.apex.chronos.app.time.TimeEntry.setcalculatedDurationHours(double
>calculatedDurationHours) with value of type
>java.lang.Long
>
>What's the recommended approach for marshalling
>non-persistent fields? If the explicite mapping is
>the correct approach, why is the JDO side of things
>failing when there is no <sql> mapping?
>
>Thanks,
>Jon
>
>p.s. I'm using Castor 0.9.5.3
>
>
>
>-----------------------------------------------------------
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
> unsubscribe castor-user
>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user