tags:

views:

1292

answers:

4

I have a Flex object which collects a DTO from the server. All the fields arrive filled in correctly except for the one that is a HashMap. It arrives as null. I've tried giving it a type of both ArrayCollection and Dictionary, but that hasn't fixed it.

Does anyone know if there's an inherent incomaptability between Java HashMap and Flex?

If not, what might I be doing wrong here? I'm looking at my jboss console and I see the data being populated correctly in the server side before delivery to the client. However, as it gets to the client, that field is null. I'm ready to kill myself.

+6  A: 

What about trying type 'Object' ?

Scott Evernden
GOD, I wish I could uptick your answer 20 or 30 more times.THANKS!
Dr.Dredel
Please quote Ryan's paragraph in your answer. You're both right, but he details the reason why, which makes for good bathroom reading.
Dr.Dredel
+6  A: 

It does look like object is what you want: http://www.mail-archive.com/[email protected]/msg17137.html

Relevant text:

When a HashMap is sent back to Flex it will simply be an Object. You can access a value by doing myObj[key]

Matt

From: [email protected] [mailto:[email protected]] On Behalf Of prasanthasi Sent: Saturday, November 26, 2005 7:24 PM To: [email protected] Subject: [flexcoders] Mapping Java HashMap to Flex Actionscript

Hi, I am trying map Java HashMap to Flex Actionscript. I have tried Object mapping and Arrays with Associative keys. Nothing worked for some reason. Please post a sample code if anyone knows how to do this.

Another possibly relevant link: http://www.nabble.com/How-to-deal-with-a-java.util.HashMap-in-flex-td17642614.html

Ryan Guill
A: 

You want to use "Object" as per the Blaze DS "data serialization" documentation:

http://livedocs.adobe.com/blazeds/1/blazeds%5Fdevguide/serialize%5Fdata%5F3.html#304283

cliff.meyers
A: 

Hi Guys,

I have tried to map the HashMap to an object, it works until I use strings, once I have an Object as a Key and a Collection(List) as a value in Java it starts melting down, I get the object as a key and the value associated with it is null.

Phani Kumar