[ 
http://issues.apache.org/jira/browse/TUSCANY-741?page=comments#action_12436628 
] 
            
Frank Budinsky commented on TUSCANY-741:
----------------------------------------

As Yang pointed out, most of the XML Schema Date types actually map to String 
in SDO. 

You can get and set them as java.util.Date by calling DataObject.getDate and 
DataObject.setDate.

For your example, you should be calling stockPurchase.setDate("purchaseDate", 
new Date)).

In general, the primitive DataObject.set() method does not do any conversion, 
but instead requires the correct type for the value. The other 
DataObject.get/setXXX() methods perform automatic conversion as specified on 
page 145 of the spec.



> ClassCastException while trying to set a date property
> ------------------------------------------------------
>
>                 Key: TUSCANY-741
>                 URL: http://issues.apache.org/jira/browse/TUSCANY-741
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java BigBank Scenario, Java SDO Implementation
>    Affects Versions: Java-M2
>            Reporter: Luciano Resende
>             Fix For: Java-M2
>
>
> Getting exception while trying to set date property : 
> stockPurchase.set("purchaseDate", new Date());
> Exception in thread "main" java.lang.ClassCastException: java.util.Date
>       at 
> com.bigbank.account.impl.StockSummaryImpl.eSet(StockSummaryImpl.java:514)
>       at 
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:653)
>       at 
> org.apache.tuscany.sdo.impl.DataObjectImpl.set(DataObjectImpl.java:140)
>       at 
> org.apache.tuscany.sdo.util.DataObjectUtil.set(DataObjectUtil.java:726)
>       at 
> org.apache.tuscany.sdo.impl.DataObjectImpl.set(DataObjectImpl.java:223)
>       at 
> bigbank.account.services.accountdb.AccountDBInit.testStrockPurchaseThroughDAS(AccountDBInit.java:303)
>       at 
> bigbank.account.services.accountdb.AccountDBInit.main(AccountDBInit.java:461)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to