Hi Jeff,
Jeff Klann wrote:
>
> This might be an extremely simple question, but I'm a newbie to Castor JDO....
>
> I am currently generating Java code from an XML Schema with Castor. Now I
> want to persist some instances of the generated Java code to a database
> (rather than marshal back to XML). Is there any way to use Castor JDO to do
> this? I was thinking I'd write a mapping file for the Java types that
> Castor generated from the Schema, but the data seems to be private.
>
Castor should generate public getters/setters (accessor methods) to
obtain
the data. A mapping file can be used.
The biggest problem when trying to use Castor-XML's source code
generator with Castor-JDO is for enumerated types. The source generator
will create type-safe enumerations, that do not have a public
constructor. The trick is to use a custom FieldHandler. I have
demonstrated how to do this in the past on the this list.
If you are not using XML Schema enumerations, then you should be able to
map the object model cleanly.
You can also use the org.exolab.castor.tools.MappingTool to help with
the initial mapping. You'll have to add <sql> elements on your own
however.
--Keith
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev