0 Replies Latest reply on Jun 11, 2008 10:58 PM by Jason Maskell

    Problem with Flamingo and Seam

    Jason Maskell Newbie

      I'm hoping this is an ok place to post this, I've been ramping up on Seam/Hibernate/EJB3/etc for over a week now in my spare time trying to convert a RoR backend to Seam. I've been reading every book I can get my hands on, 4 Apress and OReilly books so far, but I'm still not there.

      I've just got a little test app running, and I'm trying to return an entity to the Flex app and getting some problems.

      I want to return an entity bean from a query - the hibernate part is working, I can return a string and it works fine.. when I try to actually return the object it chokes. I've mapped the object like so:

      package com.tamedtornado
          public class PlayersMapping
              public function PlayersMapping()
              public var Player_id:int;
              public var Name:String;

      Now that doesn't represent the entire object, just a couple of fields on it. I'm not sure if that's an issue, as it doesn't say anything about that in the Flamingo docs. I've also tried it with a 2 field dummy object and get the same exception, so I assume that is not the problem.

      Now, when I hit the service I use this method in the bean:

          public Players getPlayer()
              return em.find(Players.class, 618895041);

      Which should be returning me my entity class. If i modify that routine to return that players name, it works fine.

      The exception I get is this:

      TypeError: Error #1034: Type Coercion failed: cannot convert mx.rpc::AsyncToken@af50941 to com.tamedtornado.PlayersMapping.
          at TestFlex/getPlayer()[D:\JavaProjects\TestFlex\src\TestFlex.mxml:13]
          at TestFlex/___TestFlex_Button1_click()[D:\JavaProjects\TestFlex\src\TestFlex.mxml:32]

      Closely followed by this:

          at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:216]
          at mx.rpc::Responder/fault()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\Responder.as:49]
          at mx.rpc::AsyncRequest/fault()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:103]
          at NetConnectionMessageResponder/channelFaultHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:623]
          at flash.events::EventDispatcher/dispatchEventFunction()
          at flash.events::EventDispatcher/dispatchEvent()
          at mx.messaging.channels::AMFChannel/statusHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\messaging\channels\AMFChannel.as:344]

      I feel like I'm getting close here, any help would be appreciated. :)