[ http://issues.apache.org/jira/browse/TUSCANY-475?page=all ]
     
ant elder resolved TUSCANY-475:
-------------------------------

    Resolution: Fixed

Applied. Thanks for the patch Kelvin!

> Class cast exception on
> -----------------------
>
>          Key: TUSCANY-475
>          URL: http://issues.apache.org/jira/browse/TUSCANY-475
>      Project: Tuscany
>         Type: Bug

>   Components: Java SDO Implementation
>     Versions: Java-M1
>  Environment: Windows XP
>     Reporter: Simon Laws
>  Attachments: T475.patch
>
> I'm trying to retrieve rows from a database via the relational DAS. When I 
> run my test prgram I get 
> Exception in thread "main" java.lang.ClassCastException: 
> org.eclipse.emf.ecore.util.EcoreEList$Dynamic incompatible with 
> commonj.sdo.DataObject
>       at 
> org.apache.tuscany.sdo.impl.DataObjectImpl.getDataObject(DataObjectImpl.java:322)
>       at 
> org.apache.tuscany.sdo.interop.SDOInterop.testReadAndWriteRelationalDB2(SDOInterop.java)
>       at org.apache.tuscany.sdo.interop.SDOInterop.main(SDOInterop.java:136)
> The code looks like.
>         CommandGroup commandGroup = 
> CommandGroup.FACTORY.createCommandGroup(getClass().getResourceAsStream("interopconfig-db2.xml"));
>         Command read = commandGroup.getCommand("all type");
>         DataObject root = read.executeQuery();
>         DataObject firstRow = root.getDataObject("alltype[0]");
> Now I expect to get a "firstRow" DataObject back. Indeed 
> DataObjectImpl.getDataObject() casts the return to a DataObject
>   public DataObject getDataObject(String path)
>   {
>     return (DataObject)get(path);
>   }
> However the the DataObjectUtil.get() operation creates an Accessor and calls 
> getAndRecycle
>   public static Object get(DataObject dataObject, String path) 
>   {
>     Property property = dataObject.getType().getProperty(path);
>     if (property != null) {
>       return dataObject.get(property);
>     } else {
>       return Accessor.create((EObject)dataObject, path).getAndRecyle();
>     }
>   }
> getAndRecycle call get which, because I have specified a 0 index, just 
> returns  the value which happens to be of type EcoreEList$Dynamic
> So while I may have an error in my code somewhere or it might not be 
> retrieving any data from the database a class cast exception  inside of SDO 
> doesn't seem like the correct way to tell me. 

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