Hibernate DataServices users,

I think we have figured out what the problem is (see below). We are using java.util.Map in our java VO, but when Hibernate is sending it back to flex it is getting converted into a hibernate "PersistentMap". This custom hibernate object implements Map, but we think that flex still doesn't know what to do with it because our objects come in empty in flex.

To test this,

1) do a RemoteObject call that returns a java.util.Map. No problem. A dynamic object is returned to Flex.

2) do a RemoteObject call that queries hibernate and returns an object of type java.util.Map. In this case it seems Hibernate wraps this into a org.hibernate.collection.PersistentMap which returns an object with no properties in actionscript.

Has anyone else run into this? Are we missing something or is this a bug in the Flex/HibernateAssembler?

Our only solution thus far is to copy the object in our java getter into a java.util.HashMap before we return it:

public Map<String, Serializable> getCustomFields() {
Map<String, Serializable> map = new HashMap<String,Serializable>();
        map.putAll(customFields);
        return map;
    }

it's a hack... but it works.

- Kevin


On Dec 19, 2007, at 4:06 PM, Kevin wrote:

We are having a weird problem with something that we think should be
simple.

We are persisting an object in our database (Hibernate) as a
java.util.Map. From actionscript to Java things work fine and
persist in the database as expected. However, when we pull it back
over the wire from the java to flex it seems to appear as an empty
obect? We have tried to trace the properties and we get nothing.

Any thought on what could be happening? I thought Maps were by
default supposed to come back as actionscript objects.

Thanks, Kevin



Reply via email to