Remap these complex types onto native Java types while copying your
entities onto your dtos... or are you sending your entities to the
client directly?

Usually, you will not want to send the entities to the client as it
exposes your data model directly. You should create your service layer
so as to be friendly to other clients besides your own. Create a
remoting API that is a bit more abstract than your entities so as to
be easily exposed through a REST API for instance.

When I copy my entities onto my dtos, some entity fields don't even
make it into the dto. Others only have getters in the dto because they
are read-only to the client. Those that do get into the dto get
converted to native Java types. For instance, Text gets converted to
String. Key gets encoded to a url friendly string. If I have Set
fields on the entities to manager my relations (property lists), I
remap those to ArrayList... First, don't serialize interfaces to GWT
client, you'll get Javascript bloat. Then, Hashmap is costly to
serialize because String.hashCode() is not the same on in Java and in
Javascript. Hence, all the items need to be re-inserted into a client
side map. Of course, in Web mode, performance is good enough... but in
development mode, your data transfers will become really slow for
somewhat big transfers.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to