i'm using the database to generate the castor xml:s. this makes the object model into a replica of the database relational one. i use jdbc meta data to generate an xml containing tables, views, columns, pk's and fk's. i tranform this into the castor schema fro the sourcegenerator and i guess will also produce the mapping.xml (if i deeme it neccessary). this make all repressentations of the model consistent.
as for generation gaps, i'll solve this by means of tranformation or default values for missing fields of older objects. of ourse, as the number of generations grow large there will be as many stylesheets to keep track of. this is not a problem for my team: we will have the data dellivered and integrated momentarily so we will never face having to face (he he) multiple versions of the data.
a sollution to this would howerver to keep the whole chunk of data in a Composite/ImportPack wilth a version attribute and then build a chain of tranformers to take the data into the "present day and age" (?).
ned,
when you import data do you have a large Composite that holds the entire data delivery or keep a lot of small files? prefferably you'd want to have one large file, of course.
~mats
Robert Ollila wrote:
Ned,
I will be doing the same sort of thing. Here are some of the problems that
I have been thinking about. Maybe you can give some input on how you plan to
handle.
1. The object model must be designed in a relational database type of model
in order to later use JDO. For example, each class should have some ID type
field, and the cardinality of the relationships may have to be defined from
several perspectives within the java classes. In other words, objects
contained within objects may need to have references to the objects that
contain them depending on your database schema. I wouldn't normally do this
if I was not going to use JDO. So, the bottom line is that JDO support can
not just come as an afterthought for ANY object model - the XML schema you
use must be designed accordingly. Any input on this ?
2. How do you plan to handle future legacy issues with the data that is
produced? For instance, i f version 1.0 of your product creates XML
instances on a users system, what happens when version 2.0 comes out and you
have changed the XML Schema and object model (maybe you added some new
fields). Will you be able to read the old XML files with the new object
model? The same question goes for the database, will you be able to read
older objects from the database? I guess this is more of a general Castor
issue though. But I am pretty concerned about it. My solution for now is
to require that any new fields added to an older schema must be "optional"
so that you don't get validation exceptions when you try to unmarshal an
older XML instance with the newer java class. That's kind of kludgy though.
Any suggestions?
Bob.
-----Original Message-----
From: Ned Wolpert [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 23, 2002 11:46 AM< br>To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] using castor for data import from XML into DB
Mats-
I'm actually doing this currently. Basically, I've got an XML Schema
that describes my object model. I use the source generator to create
the java classes that can serialize out to XML via Castor XML. Then I
turn around and map those same classes to the database via Castor JDO.
The amount of code I have to write is quite small since the object model
is all in the schema, and changes get propagated quickly. (And for
extra points, I have an Soap interface that can be used as well, but
that's a different story... ;-)
On Wed, 2002-01-23 at 09:31, mats nyberg wrote:not very devvy, but what do you guys think about...
we have a database of our own design and want to import data from
an external supplier into it. this is supposed to happen regularly/a lot
of times.
we have settled for using XML as the desired delivery format and use
W3C Schema as a spec for the supplier.
we can produce a W3C Schema describing the database and will use this
to transform into Castor SourceGen Schema as well as mapping.xml files.
OK, for those of you that haven't figured out the punch line yet, howaboutrecieving the XML (validated against the Schema) and use the beans to
unmarschall alot of beans to put into our DB (by the means of JDO).
i know i read some thread about this some time ago... how did that turnout?any other experiences? things to look out for etc?
Mats Nyberg
----------------------------------------------------
Systems designer/Chief developer
Teknik i Media Sverige AB (publ)
Address: Södra Förstadsgatan 2, SE-211 43 Malmö, Sweden
Direkt: +46 40 601 57 10
Mobile: +46 70 420 57 10
Växel: +46 40 601 57 00
http://www.tim.se
DISCLAIMER: "The information contained in this email and any attachment is
confidential. It is intended only for the named addressee(s). If you are
not
the named addressee please notify the sender immediately and do not
disclose, copy or distribute the contents to any other person other than
the
intended addressee(s)."
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
