This one time, at band camp, Jamie De Wet said:

JDW>In the abstract class TransactionType -- Castor creates a Vector
JDW>financialList; -- the return type of the method getFinancial() is
JDW>Financial[] -- eg.
JDW>
JDW>public Financial[] getFinancial()   {
JDW>        int size = _financialList.size();
JDW>        Financial[] mArray = new Financial[size];
JDW>        for (int index = 0; index < size; index++) {
JDW>            mArray[index] = (Financial) _financialList.elementAt(index);
JDW>        }
JDW>        return mArray;
JDW>}
JDW>
JDW>My problem comes in using mapping file where I don't know how to set the
JDW>collection if my return type in my class is Financial[] and not something
JDW>like Vestor, Array, Enumeration etc.
JDW>
JDW>eg of Mapping
JDW><mapping>
JDW>    <class name="jdo.databinding.Transaction" identity="ddId">
JDW>            <description>Transaction</description>
JDW>            <map-to table="transaction" xml="transaction"/>
JDW>            <field name="ddId">
JDW>                    <sql name="dd_id" type="integer"/>
JDW>                    <bind-xml name="ddId" node="attribute"/>
JDW>            </field>
JDW>            <field name="name">
JDW>                    <sql name="name"/>
JDW>                    <bind-xml name="name" node="element"/>
JDW>            </field>
JDW>            <!-- Transaction has reference to Financial - many
JDW>financials per transaction  -->
JDW>            <field name="financial" type="jdo.databinding.Financial"
JDW>collection="Vector">    ------ problem using this line as my collection
JDW>should be Financial[]
JDW>                    <sql many-key="trans_id"/>
JDW>                    <bind-xml name="financial" node="element"/>
JDW>            </field>
JDW>    </class>

Jamie,

I've not used Arrays myself, but have you tried setting the
collection attribute to array instead of vector?

    http://www.castor.org/jdo-mapping.html#The-%3Cfield%3E-element

I'm curious to know the outcome of this so that I can provide an example
of using an array as a collection.

Bruce
-- 
perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

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

Reply via email to