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
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 problem i have is giving the objectB the id of objectA to store as a
foreign key.
I have mapped the objects as follows
<class name="com.bean.objectA" identity="objectAid" key-generator="MAX">
<description>ObjectA</description><cache-type type="none"/>
<map-to table="ObjectA" xml="objectA"/>
<field name="objectAid" type="integer">
<sql name="objectAid" type="integer"/>
<bind-xml node="element"/>
</field>
<field name="objectsB" type="com.bean.objectB"
collection="arraylist" lazy="true">
<sql many-key="objectA_id"/>
<bind-xml node="element"/>
</field>
</class>
<class name="com.bean.objectB" identity="objectBid" key-generator="MAX">
<description>ObjectB</description><cache-type type="none"/>
<map-to table="ObjectB" xml="objectA"/>
<field name="objectBid" type="integer">
<sql name="objectBid" type="integer"/>
<bind-xml node="element"/>
</field>
<field name="objectA" type="com.bean.objectA" >
<sql name="objectA_id"/>
</field>
</class>
What is the usual way of doing this.
Is there any performance problems when having a relation in a child object
pointing to the father object??
for example having objectA in objectB..... makes the collection copy itself
many times
any help would be appreciated!!!
thanks in advance
--
View this message in context:
http://www.nabble.com/Persist-object-with-child-collection-tf3865521.html#a10950801
Sent from the Castor - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email