Of course :

This is my class mapping :

    <class name="com.omerin.nc.jdo.Ncf" identity="id"
key-generator="IDENTITY">
        <description>ncf</description>
        <map-to table="ncf" xml="ncf" />
        <field name="id" type="long" required="true">
            <sql name="id" type="integer" />
            <bind-xml node="element" />
        </field>
        <field name="nature" type="com.omerin.nc.jdo.Nature"
required="true">
            <sql name="typeid"/>
            <bind-xml node="element" />
        </field>
        <field name="acteur" type="com.omerin.nc.jdo.Acteur"
required="true">
            <sql name="creatorid" />
            <bind-xml node="element" />
        </field>
        <field name="crdate" type="date" required="true">
            <sql name="crdate" type="date" />
            <bind-xml node="element" />
        </field>
        <field name="etat" type="com.omerin.nc.jdo.Etat" required="true">
            <sql name="etatid"/>
            <bind-xml node="element" />
        </field>
        <field name="extcontact" type="string">
            <sql name="extcontact" type="char[40]" />
            <bind-xml node="element" />
        </field>
        <field name="tname" type="string" required="true">
            <sql name="tname" type="char[60]" />
            <bind-xml node="element" />
        </field>
        <field name="tid" type="string">
            <sql name="tid" type="char[32]" />
            <bind-xml node="element" />
        </field>
        <field name="pname" type="string" required="true">
            <sql name="pname" type="char[128]" />
            <bind-xml node="element" />
        </field>
        <field name="pid" type="string">
            <sql name="pid" type="char[32]" />
            <bind-xml node="element" />
        </field>
        <field name="description" type="string">
            <sql name="description" type="char[128]" />
            <bind-xml node="element" />
        </field>
        <field name="repo_path" type="string">
            <sql name="repo_path" type="char[128]" />
            <bind-xml node="element" />
        </field>
        <field name="blAsReference" type="com.omerin.nc.jdo.Bl"
collection="arraylist">
            <sql many-key="ncfid" />
        </field>
        <field name="suiviAsReference" type="com.omerin.nc.jdo.Suivi"
collection="arraylist">
            <sql many-key="ncfid" />
        </field>
        <field name="factureAsReference"
type="com.omerin.nc.jdo.Facture" collection="arraylist">
            <sql many-key="ncfid" />
        </field>
        <field name="lotAsReference" type="com.omerin.nc.jdo.Lot"
collection="arraylist">
            <sql many-key="ncfid" />
        </field>
        <field name="coutAsReference" type="com.omerin.nc.jdo.Cout"
collection="arraylist">
            <sql many-key="ncfid" />
        </field>
    </class>

And this is the xsd :

    <xs:element name="ncf">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="avoir" minOccurs="0"
maxOccurs="unbounded" />
                <xs:element ref="bl" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element ref="cout" minOccurs="0"
maxOccurs="unbounded" />
                <xs:element ref="facture" minOccurs="0"
maxOccurs="unbounded" />
                <xs:element ref="lot" minOccurs="0" maxOccurs="unbounded" />
                <xs:element ref="suivi" minOccurs="0"
maxOccurs="unbounded" />
                <xs:element ref="etat" minOccurs="1" maxOccurs="1" />
                <xs:element ref="acteur" minOccurs="1" maxOccurs="1" />
                <xs:element ref="nature" minOccurs="1" maxOccurs="1" />
            </xs:sequence>
            <xs:attribute name="id" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:integer">
                        <xs:maxInclusive value="2147483647" />
                        <xs:minInclusive value="-2147483648" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="crdate" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:dateTime">
                        <xs:pattern
value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}T\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="extcontact">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:maxLength value="40" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="tname" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:maxLength value="60" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="tid">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:maxLength value="32" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="pname" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:maxLength value="128" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="pid">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:maxLength value="32" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="description">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:maxLength value="128" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="repo_path">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:maxLength value="128" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
        </xs:complexType>
    </xs:element>


Werner Guttmann a écrit :
>
> Can you provide me with the complete (though) minimal class mapping
> you are trying to create for Castor JDO, using the classes as
> generated by the source generator. And what does the corresponding
> complex type def look like ?
>
>  
>
> Werner
>
>  
>
> ------------------------------------------------------------------------
>
> *Von:* Sébastien PERES-LABOURDETTE - Public
> [mailto:[EMAIL PROTECTED]
> *Gesendet:* Montag, 02. April 2007 12:33
> *An:* [email protected]
> *Betreff:* Re: AW: AW: [castor-user] Castor Xsd -> Jdo mapping
>
>  
>
> Sorry, i should have written :
>
>         <field name="blAsReference" type="com.omerin.nc.jdo.Bl" 
> collection="arraylist">
>             <sql many-key="ncfid" />
>         </field>
>  
> Now MappingException have gone.
>  
> Thanks.
>
> Sébastien PERES-LABOURDETTE - Public a écrit :
>
> For the context :
>  
> I'm doing some Jdo stuff.
>  
> >From my jdo mapping file, i have :
>  
>         <field name="bl" type="com.omerin.nc.jdo.Bl" collection="arraylist">
>             <sql many-key="ncfid" />
>         </field>
>  
> Now, at run time i got
>  
> org.exolab.castor.mapping.MappingException: The return type for method
> public com.omerin.nc.jdo.Bl[] com.omerin.nc.jdo.Ncf.getBl() does not
> match the declared field type java.util.ArrayList
>  
> How can i solve this ?
>  
>  
> Werner Guttmann a écrit :
>   
>> Interesting. You are supplying a '-types arraylist' parameter already .. 
>> ;-). Iow, you should be getting Collection classes (namely 
>> java.util.(Array)List) already in your generated sources.
>>  
>> Hmm ...
>> Werner
>>  
>> ________________________________________
>> Von: Sébastien PERES-LABOURDETTE - Public [mailto:[EMAIL PROTECTED] 
>> Gesendet: Montag, 02. April 2007 11:40
>> An: [email protected] <mailto:[email protected]>
>> Betreff: Re: AW: [castor-user] Castor Xsd -> Jdo mapping
>>  
>> >From sample source gen ".bat".
>>  
>> %JAVA% -cp %CP% org.exolab.castor.builder.SourceGeneratorMain -dest 
>> d:\java\dev\ofc -i %1.xsd -package %2 -f -types arraylist -type-factory 
>> arraylist -verbose
>>  
>> Is that correct ?
>>  
>> (JDK-1.6 / Castor-1.1)
>>  
>> Werner Guttmann a écrit : 
>> What tool are you using to start source code generation ? Ant ? Maven ? 
>>  
>> Werner
>>  
>>   
>> -----Ursprüngliche Nachricht-----
>> Von: Sébastien PERES-LABOURDETTE - Public [mailto:sebastien.peres-
>> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>]
>> Gesendet: Montag, 02. April 2007 10:28
>> An: Castor User
>> Betreff: [castor-user] Castor Xsd -> Jdo mapping
>>  
>> Hi.
>>  
>> I have an xsd file containing an element :
>>  
>>     <xs:element name="ncf">
>>         <xs:complexType>
>>             <xs:sequence>
>>                 <xs:element ref="bl" minOccurs="0" maxOccurs="unbounded"/>
>>                 <xs:element ref="nature" minOccurs="1" maxOccurs="1" />
>>             </xs:sequence>
>>              ......
>>  
>> SourceGenerator generates a getter :
>>  
>>     public com.omerin.nc.jdo.Bl[] getBl() {
>>         com.omerin.nc.jdo.Bl[] array = new com.omerin.nc.jdo.Bl[0];
>>         return (com.omerin.nc.jdo.Bl[]) this._blList.toArray(array);
>>     }
>>  
>> This getter returns an array, is there a way to make it return an
>> arrayList ?
>>  
>> Thanks
>>  
>> --
>> Sébastien PERES-LABOURDETTE
>>  
>> ---------------------------------------------------------------------
>> To unsubscribe from this list please visit:
>>  
>>     http://xircles.codehaus.org/manage_email
>>     
>>  
>>  
>> ---------------------------------------------------------------------
>> To unsubscribe from this list please visit:
>>  
>>     http://xircles.codehaus.org/manage_email
>>  
>>  
>>  
>>   
>>  
>>   
>>     
>  
>   
>
>  
>
> -- 
> Sébastien PERES-LABOURDETTE
>

-- 
Sébastien PERES-LABOURDETTE

Reply via email to