Hi,
   I am not absolutely sure but there is another attribute for the fields
element, try making this also package specific.
   e.g.
 <?xml version="1.0"?>
 <mapping>
   <class name="myclass.ClassName">
      <field name="someFieldName" type="string"
                handler="package.MyHandler"/>
   </class>
 </mapping>

    Hope this helps.

-- Uddhav
----- Original Message -----
From: "Hugues Pichereau" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 13, 2002 4:06 PM
Subject: [castor-dev] Inheritance and packages


> Hello Castors,
>
> I need to use super-classes java-side, and sub-classes xml-side :
> For instance, I have a generic "Field" class (its objects stored in a
> List attribute of a "Form" class) with polymorphic methods (such as
> getAttributes). I also have some sub-classes like "TextField" or
> "RadioField" wich inherit from "Field", but I don't want to manipulate
> them java-side, only their Field super-class. Those TextField and
> RadioField sub-classes are intialized in the XML, directly as child of
> the "Form" element (no Field element in the XML).
>
> As I did not use Java packages, this worked FINE with Castor, with a
> simple mapping for lists, all objects were correctly instantiated.
>
> BUT here comes the issue, when I use packages (of course I put the new
> package name before the class name in Castor mapping class element),
> this does not work anymore : "org.xml.sax.SAXException: unable to find
> FieldDescriptor for 'text-field' in ClassDescriptor of form {file: [not
> available];"
> <mapping>
>     <class name="form.Form" auto-complete="true">
>         <map-to xml="form" />
>         <field name="FieldsList" type="form.Field"
> collection="collection">
>             <bind-xml name="field" />
>         </field>
>     </class>
>     <class name="form.RadioField" auto-complete="true">
>         <field name="LabelsList" type="java.lang.String"
> collection="collection">
>             <bind-xml name="label" />
>         </field>
>         <field name="SelectedList" type="java.lang.Integer"
> collection="collection">
>             <bind-xml name="selected" />
>         </field>
>     </class>
>     <class name="form.TextField" auto-complete="true" >
>           <field name="TextLabel" type="java.lang.String"
> node="element">
>           </field>
>     </class>
> </mapping>
>
> I do no see the link between packages and inheritance. Surely the
> solution is in the mapping file. Is there somebody who can help ? Thanks
> in advance.
>
> --
> Hugues Pichereau - Webmaster
> Telemedicine Technologies
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
>

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

Reply via email to