Hi,
 
is there a way to get object-IDs (for the "identity" attribute) automatically 
generated by Castor for XML (!) binding. I noticed the key-generator feature for JDO, 
but did not manage to get it working for marshalling to XML.
 
I am currently using the "identity & reference"-feature of Castor to manage the 
serialization of potential circular object-trees with multi-references. Therefore - as 
I have understood - we need to provide unique IDs for each object. By now, I create 
those IDs manually with the help of getId() and setId() methods for each of my 
serializable objects. But I believe that this can't be the preferred way!?!

Here is my mapping file, where the "key-generator" attribute seems to be ignored:

<?xml version="1.0"?>
<mapping>
        <description>Castor-Mapping</description>

        <class name="ClassA" identity="id" key-generator="MAX" auto-complete="true">
                        <map-to xml="ClassA"/>
            <field name="id" type="string">
                <xml name="id" node="attribute"/>
            </field>
            <field name="val" type="ClassA">
               <bind-xml name="val" node="element" reference="true"/>
            </field>
        </class>

        <class name="ContainerA">
                        <map-to xml="ContainerA"/>
            <field name="vec" type="ClassA" collection="vector">
            </field>
        </class>
                
        <class name="ContainerB">
               <map-to xml="ContainerB"/>
            <field name="vec" type="ClassA" collection="vector">
               <bind-xml name="vec" node="element" reference="true"/>
            </field>
        </class>
</mapping>

If there is a more elegant way, I would appreciate any hints and helpful code samples 
(especially how to change the mapping file).
 
Armin



-- 
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

One click access to the Top Search Engines
http://www.exactsearchbar.com/mailcom

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to