Hi.

 

I’m facing a strange marshalling behavior that i cannot explain to myself
even after running sample unit tests with Castor 1.1 / 1.1.1.

 

Here is sample of the concerned mappings :

 

<?xml version="1.0" encoding="UTF-8"?>

<mapping>

                <class name="com.omerin.tscables.pmics.jdo.CLIENT"
identity="CLKTSOC CLKTCODE">

                               <description>CLIENT</description>

                               <map-to table="client" xml="client"/>

                               <field name="CLKTSOC" type="string">

                                               <sql name="CLKTSOC"
type="char[3]"/>

                                               <bind-xml node="element"/>

                               </field>

                               <field name="CLKTCODE" type="string"
required="true">

                                               <sql name="CLKTCODE"
type="char[6]"/>

                                               <bind-xml node="element"/>

                               </field>

                               <field name="CLCTETS" type="string">

                                               <sql name="CLCTETS"
type="char[2]"/>

                                               <bind-xml node="element"/>

                               </field>

                …………………

 

(Notice I use multiple field identities)

 

Then, executing the code below :

 

                               db.begin();

                               Object[] key = new Object[2];

                               key[0] = new String("103");

                               key[1] = new String("100106");

 

                               CLIENT client = (CLIENT)
db.load(CLIENT.class, new Identity(key));

                               try {

                                               Marshaller m = new
Marshaller(new PrintWriter(System.out));

 
m.setMapping(DbProvider.getInstance().getMapping());

                                               m.marshal(client);

                               } catch (Exception e) {

                                               e.printStackTrace();

                               }

                               db.commit();

                               db.close();

 

 

Produces at System.out :

 

<?xml version="1.0" encoding="UTF-8"?>

 

<client>

    <CLKTSOC>103</CLKTSOC>

    <CLCTETS>00</CLCTETS>

……

 

It is like the marshaller does marshall only on the first field (left most)
of the “multiple field” identity.

I have 5 classes of that kind.

 

Does something have changed marshalling identities while migrating from
Castor 1.0.1 Complex to Castor 1.1 Identity ?

 

Anyone to help me marshalling all of my identity fields ?

 

 

Sébastien PERES-LABOURDETTE

 

 

Reply via email to