Hello!

You can't do this becose imagene that you want perform OQL select from
JDO database that field castor will select?. Ok, if you not using JDO.
Imagine that it's just object and object have one field (cos only unique
name fields allow in Java class), but this filed have two direfent type:
Just like this:
class MyClass {
  private String param;
  private Integer param;
}
It's whong.
If you want you can manualy get list of all puted objects and manual
perform unmarshaling per each object. And accumulate into whole XML.

You can also make one interface or base abstract class: MyBaseObject.
Extends or implements all your objects from it and in mapping just
describe an collection field:

        <class name="com.lanchile.modseg.xml.Parameters">
                <map-to xml="Modificar"/>
                <field name="param" type="integer">
                        <bind-xml name="Codigo"/>
                </field>
                <field name="myObjects"
type="acme.my.package.MyBaseObject" collection="arraylist">
                </field>
        </class>

class MyClass {
  private ArrayList myObjects = new ArrayList();
  ...
}

maybe this help you, but I not successfully sure about this.

Good Luck!



-----Original Message-----
From: Juan Fuentes [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 23, 2003 5:32 PM
To: [EMAIL PROTECTED]
Subject: [castor-dev] Mapping various ELE to one field


I have a class which has a generic list of objects. I wish to place the
values of differente elements tag into the list of object, for example,
the
elements:

<name>John</name>
<country>Chile</country>

map to an overloades method:

params(String s)
params(int i)
params(Data d)

which basically

List.add(entryParam).

When I map one field it works ok but if I map more elements to one field
I get the error:

"The field param appears twice in the descriptor for
com.lanchile.modseg.xml.Parameter"

Here an example of the mapping xml:

<mapping>
        <class name="com.lanchile.modseg.xml.Transaction">
                <map-to xml="LanChile_SistemasExternos_Query"/>
                <field name="parameters"
type="com.lanchile.modseg.xml.Parameters"/>
        </class>
        <class name="com.lanchile.modseg.xml.Parameters">
                <map-to xml="Modificar"/>
                <field name="param" type="integer">
                        <bind-xml name="Codigo"/>
                </field>
                <field name="param" type="string">
                        <bind-xml name="Descripcion"/>
                </field>
        </class>
</mapping>
Can anyone help?!?




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.441 / Virus Database: 247 - Release Date: 1/9/2003

----------------------------------------------------------- 
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