Hi there. I have a problem getting this to work.

Say i have a bean called objectA that has a collection(ArrayList()) of beans
type objectB and they also have collections of other beans x,y,z collections
or not.

I need to load the objectA from database marshall it to xml and later
unmarshall it from xml and persist into the database as NEW objects.

The main problem is (i think) how to represent the foreign keys so that
Castor doesnt use the foreign keys marshalled but assigns new ones..

For example: create objectA in database and then give objectA´s id to its
children and so on.

Do i use an object type reference in the child objects or a field (integer)
type.

field type
        <field name="idObjectAtype="integer">
            <sql name="idobjectA" type="integer"/>
            <bind-xml node="element"/>
        </field>

or
object type
        <field name="objectA" type="com.bean.ObjectA">
            <sql name="ObjectA"/>
            <bind-xml node="element"/>
        </field>

If i use an object type... for example

ObjectA has collection of ObjectB´s. ObjectB has an ObjectA reference type
object. When i unmarshall i will have

ObjectA with a collection of ObjectB´s which have an objectA which again has
a collection of ObjectB´s.........

If i use a field type reference in objectB then it marshalls great but when
i try to persist the object (db.create(ObjectA) oracle gives me an foreign
key exception saying it cannot be null. So it doesnt assign the parent
primary key to its children as a foreign key.

Isnt there a way to make this happen using field type foreign keys??? or any
other way you can think of??

keep up the excelent work!!!

-- 
View this message in context: 
http://www.nabble.com/export-to-xml-and-import-into-database-tf3900845.html#a11058426
Sent from the Castor - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to