Ok, I think I figured this out. In addition to what I have described
above, I did need a custom serializer. Provided, I don't have too many
classes to serialize in a custom way, I guess that's the way to go.

[code]
package dao;

import com.google.gwt.user.client.rpc.SerializationStreamWriter;
import com.google.gwt.user.client.rpc.SerializationException;
import com.google.gwt.user.client.rpc.SerializationStreamReader;
import java.util.List;
public class EntityWithObjectReference_CustomFieldSerializer {
    public static void serialize(SerializationStreamWriter writer,
EntityWithObjectReference entity) throws SerializationException {
        writer.writeObject(entity.getSerializableEntities());
        writer.writeString(entity.getText());
    }

    public static void deserialize(SerializationStreamReader reader,
EntityWithObjectReference entity) throws SerializationException {
        entity.setSerializableEntities((List<SerializableEntity>)
reader.readObject());
        entity.setText( reader.readString());
    }
}
[/code]


Note, I did extend the original class a little to make the test
somewhat more complete:

[code]
public class EntityWithObjectReference {
    public Object objReference;
    private String text;
    private List<SerializableEntity> serializableEntities;
    public EntityWithObjectReference() {
    }

    public List<SerializableEntity> getSerializableEntities() {
        return serializableEntities;
    }

    public void setSerializableEntities(List<SerializableEntity>
serializableEntities) {
        this.serializableEntities = serializableEntities;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }
}
[/code]

On Sep 21, 1:22 pm, Andrius Juozapaitis <[email protected]> wrote:
> > Use wrapper-classes containing only the values you need in your
> > GWT-application. The server creates these objects out of the
> > server-side instances and set the values when received from the
> > client. It's more or less the same as you already did but with
> > the difference that you don't rely on the "intelligence" of
> > the compiler but take that into your own hands.
>
> I am reluctant to maintaining another layer of essentially duplicate
> classes, as well as creating all the data copying logic (I guess this
> could be accomplished by an aspect, as I am using Spring in the
> backend). I've considered using a custom Serializer/Deserializer, but
> was hoping there's a way to avoid it. Oh well, back to drawing board.
>
> Unless somebody comes up with a better idea, of course - I am open for
> suggestions :)
>
> regards,
> Andrius
--~--~---------~--~----~------------~-------~--~----~
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