Hi,

whilst I hate to say this, it works fine for me. If you wanted, I could
send your all the files I did create locally to reproduce rhis problem.

Regards
Werner

mnradhaki wrote:
> I have a class called Amount which implements IAmount.  It has one property
> called "amount" which is of type java.math.BigDecimal.  This Amount class is
> being referenced inside another class called SAP.  I use a mapping file. 
> When I marshall the Java Object, I see the generated XML which has the
> <amount>value</amount>, but when unmarhsalling it, I get the value as 0.  I
> am pretty sure I am doing something wrong in the mapping.xml.  If I don't
> specify the mapping.xml, then I get an error about balance(IAmount) does not
> match with Amount.  Can someone please help me out here?
> 
> Here are the details:
> 
> public class SAP {
>     private IAmount balance;
>     public IAmount getBalance() {
>         return balance;
>     }
> 
>     public void setBalance(string amount) {
>         balance = new Amount(amount);
>     }
> }
> 
> public class Amount implements IAmount {
>     private BigDecimal amount;
> 
>     public Amount(String amount) {
>         setAmount(amount)
>     }
> 
>     public BigDecimal getAmount() {
>         return amount;
>     }
>     public void setAmount(String amount) {
>         this.amount = new BigDecimal(amount);
>     }
> }
> 
> public interface IAmount {
>     public void setAmount(BigDecimal amount);
>     public BigDecimal getAmount();
> }
> 
> mapping.xml
> 
> <?xml version="1.0"?>
> 
> <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
>                          "http://castor.org/mapping.dtd";>
> 
> <mapping>
>   <class name="SAP" auto-complete="true">
>       <map-to xml="data-object"
> ns-uri="http://www.w3.org/2001/XMLSchema-instance";
>            ns-prefix="xsi" />
>    
>     <field name="balance" type="IAmount">
>       <bind-xml name="balance" node="element" />
>     </field>
>   </class>
> </mapping>
> 
> Generated XML contains:
> 
>         <balance xsi:type="java:Amount">
>             <amount>3469.78</amount>
>         </balance>
> 
> Thanks,
> Radha

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to