views:

170

answers:

1

Hi, I've got a problem with type coercion in a Java/Hibernate/BlazeDS/Flex-Setup.

First of all, my classes look like this:


--- JAVA ---

Interface I
(Abstract) Class A implements I
Class B extends A

--- ActionScript ---

Interface I
Class A implements I
Class B extends A


I got RemoteClass-Meta-Tags in all ActionScript-Classes/Interfaces I, A and B. Package structure and Class/Interface names are exactly the same.

Now here's the problem: My Java Service successfully retrieves objects of class B from my database via Hibernate. I got another class C which has a member property of interface type I, so it should be possible to assign an object of type B. But for some reason i get the following error message:

TypeError: Error #1034: cannot convert Object@28b44a89 to package.name.I

I checked the Java object type in the service and it is of type B and seems to be totally fine. Why can't the object of type B be assigned to a member variable of type I? This is driving me nuts.

Thanks in advance.

A: 

Check the type the objects returned by the service call (inspect the result with a debugger in Flash Builder). Maybe they are not properly converted to type B and an ObjectProxy is created. If it's not the case, please post your code.

Cornel Creanga