Title: many-key

Hi,

Does anyone have "depends" for a collection of items, with the many-key working in Castor 0.9.3?

This is my situation:
I have an object that declares a collection like so:

    <key-generator name="SEQUENCE" alias="MY_SEQ">
        <param name="sequence" value="seq_{0}_id" />
        <param name="returning" value="true" />
    </key-generator>

<class name="myapp.Container" identity="id" key-generator="MY_SEQ">
...
        <field name="id" type="integer">
                <sql name="id" type="integer" />
        </field>
        <field name="items" collection="arraylist" type="myapp.Item">
                <sql many-key="containerId" />
        </field>
...
</class>
...
<class name="myapp.Item" identity="id" key-generator="MY_SEQ" depends="myapp.Container">
        <field name="id" type="integer">
                <sql name="id" type="integer" />
        </field>
...
        <field name="containerId" type="integer">
                <sql name="containerId" type="integer" />
        </field>
</class>

The objects get created just fine, with correct "id" columns from the sequence, but containerId is filled with 0 (or whatever the default in Java is). If I override addItem in Container to set the id, it hasn't been allocated yet.

I haven't used depends before, so I would setup the id link and create the object myself.

Sorry, can't try it with Castor 0.9.3.9+ because of the bugs in FieldMolder. (I'm working on that...)

Cheers,
Brett

~*~*~*~*~*~*~
Brett Porter - Web Developer
f2 Network ~ everything essential
Ph: +61 2 8596 4437
Email: [EMAIL PROTECTED]

Reply via email to