I'm trying out the data management service. I've developed a very
simple example but I'm having a problem with the data types. When I
change the data, my updateItem method is being called but I cannot
cast them to their proper data types. I get the following error:


[RPC Fault faultString="Could not invoke sync method on data adapter
for destination 'wishlist' due to the following error: class
java.lang.ClassCastException:flex.messaging.io.amf.ASObject."
faultCode="Server.Processing" faultDetail="null"]
        at
mx.data::ConcreteDataService/http://www.adobe.com/2006/flex/mx/internal::dispatchFaultEvent()[C:\dev\enterprise_gmc\frameworks\mx\data\ConcreteDataService.as:1602]
        at
mx.data::CommitResponder/fault()[C:\dev\enterprise_gmc\frameworks\mx\data\CommitResponder.as:167]
        at
mx.rpc::AsyncRequest/fault()[C:\dev\enterprise_gmc\frameworks\mx\rpc\AsyncRequest.as:107]
        at
NetConnectionChannel.as$37::NetConnectionMessageResponder/NetConnectionChannel.as$37:NetConnectionMessageResponder::statusHandler()[C:\dev\enterprise_gmc\frameworks\mx\messaging\channels\NetConnectionChannel.as:458]
        at
mx.messaging::MessageResponder/status()[C:\dev\enterprise_gmc\frameworks\mx\messaging\MessageResponder.as:225]
        
        
Perhaps I've missed a step or I have cocnfiguration problems. I'll
post some code below. Please let me know if you can spot any problems.


data-management-config.xml:
===========================================================
<?xml version="1.0" encoding="UTF-8"?>
<service id = "data-service"
         class = "flex.data.DataService"
         messageTypes = "flex.data.messages.DataMessage">

  <adapters>
    <adapter-definition id = "actionscript" class =
"flex.data.adapters.ASObjectAdapter" default = "true" />
    <adapter-definition id = "java-dao" class =
"flex.data.adapters.JavaAdapter" />
  </adapters>

  <default-channels>
    <channel ref = "my-rtmp" />
  </default-channels>

  <destination id = "wishlist">
    <adapter ref = "java-dao" />
    <properties>
      <source>com.test.flex.assemblers.WishListAssembler</source>
      <scope>application</scope>
      <cache-items>true</cache-items>
      <metadata>
        <identity property = "id" />
      </metadata>
      <network>
        <session-timeout>20</session-timeout>
        <paging enabled = "true" pageSize = "10" />
        <throttle-inbound policy = "ERROR" max-frequency = "500" />
        <throttle-outbound policy = "REPLACE" max-frequency = "500" />
      </network>
    </properties>
  </destination>
</service>



Assembler:
===========================================================
package com.test.flex.assemblers;

import com.test.flex.util.SpringUtils;
import com.test.wishlist.data.model.Item;
import com.test.wishlist.data.service.ItemService;
import com.test.wishlist.ws.StoreIndex;
import flex.data.assemblers.AbstractAssembler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.List;

public class WishListAssembler extends AbstractAssembler {

   private static Log log = LogFactory.getLog(WishListAssembler.class);
   ItemService itemService

   public WishListAssembler() {
      super();
      this.itemService = (ItemService) SpringUtils.getBean("itemService");
   }

   @Override
   public List<Item> fill(List list) {
      List<Item> results = itemService.findByKeywordsAndStore("j2ee",
StoreIndex.BOOKS);
      return results;
   }

   @Override
   public void updateItem(Object currentObject, Object previousObject,
List changes) {
      Item current = (Item)currentObject;
      Item previous = (Item)previousObject;
      if (log.isDebugEnabled()) {
         log.debug("new object: " + current);
         log.debug("previous object: " + previous);
         log.debug("changes: " + changes);
      }
   }

}


AS model object: 
===========================================================
package com.test.wishlist.model {
        import com.test.common.model.GenericEntity;
        
        [Managed]
        [RemoteClass(alias="com.test.wishlist.data.model.Item")]
        public class Item extends GenericEntity  {
                public var price:Number;
                public var name:String;
                public var url:String;
        }
}


MXML init method:
===========================================================
[Bindable]
public var items:ArrayCollection;

public function initApp():void {
        items = new ArrayCollection();
        wishListDs = new DataService("wishlist");
        wishListDs.fill(items);                         
}






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to