Hi Andre,

Object itself is not serializable, so I think your HashMap will fail
over RPC. The question of how to return a single collection of
different types over RPC has come up before. AFAIK the recommended way
to do this as of now is explained by Scott Blum in this post over on
the contributors forum:

http://groups.google.com/group/Google-Web-Toolkit-Contributors/browse_thread/thread/25d151960b48b5c4/19c5f2fb8510f29a?lnk=gst&q=scott+DTO#

Basically you need a wrapper class for your arbitrary objects (he
calls it a DTO) in which you specify a dummy field for each actual
type you want to send over the wire, and you also need a simple custom
serializer. The dummy fields enable the GWT compiler to set up the
javavscript deserailisers for each of them and the security white list
as well. You can then load any number of them into a single collection
for transport over RPC. I've tested this using an ArrayList and it
works - I can see no reason why it wouldn't also work with a HashMap.

There is talk of using annotations to achieve the same effect in the
future on this post.

regards
gregor

On Sep 11, 7:35 pm, Andre de Cavaignac <[EMAIL PROTECTED]> wrote:
> Hello all,
> I am trying to execute a remoting call from a GWT client to one of the
> RemoteServiceServlets I've built.  The object I want to send across
> the wire looks like this:
>
> public class MyObject
>   implements IsSerializable
> {
>    private HashMap<String, Object> _properties = new HashMap<String,
> Object>();
>
> }
>
> The hash map contains a mix of Strings, Dates and integers, as well as
> child objects that derive from MyObject.
>
> When I try to send it across the wire, I get a
> SerializationException.  If I mark the HashMap as transient, the
> object serializes fine.  Clearly there is something with serializing
> this HashMap which is not working properly.
>
> Is there a way to fix this, or a recommended practice to have sparse
> sets of data serialized over the wire?
>
> Thanks in advance,
> Cheers,
> Andre
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to