GWT + GAE common issues.

51 views
Skip to first unread message

MagusDrk

unread,
Oct 28, 2011, 4:26:20 PM10/28/11
to Google Web Toolkit
Hi everybody.

Im Miguel. I'm posting because I'm really worry about the use of GWT
and GAE.

In my particular case, I'm trying to buid an app wich uses a logical
model in client side as in server side. In my model I use persistence
tags (JDO) to save data in the datastore and the datastore.Key class
to handle ids. Ultil today it has been totally imposible to use this
(or an emulated) class in the client side.

I've consumed all posible options I've found in internet, even those
"hack" solution with jars or configs wich emulate the source, etc...

I've read some sites when said GWT 2.0 will solves that issue (2009
and older) ... I have GWT 2.4 and I have exactly the same issues.

I wonder if someone can tell me: 1, if this classes (Key, User, etc.)
will be included in some release of GWT or not. and 2: how do those
great enterprises build those great applications with GWT if there is
a huge wall with than kind of issues as use of persistent classes? how
do they comunicate persistence model via RCP? 3. arquitectures as MVP
are really usefull in side client separatelly from persistence model?

I hope find some quick help.

Thanks.

Patrick Julien

unread,
Oct 28, 2011, 7:56:37 PM10/28/11
to google-we...@googlegroups.com
1. I don't think so.  They're meant to be used from the server side of GWT.  For exposing server objects you use RequestFactory in combination with ValueProxy
2. I suggest you take a look at the "expenses" sample that comes with GWT.


You can see the Employee object in its server version here:
and its client representation here:

RequestFactory intro here:


3. MVP won't really touch this since it's client side so it only sees proxy types

So if you want to expose an AppEngine key, you would use KeyFactory to convert it to a string for the client and back to a string for the server.  If you want to expose AppEngine's User object, you would use a ValueProxy instead of an EntityProxy, e.g.,

@ProxyForName("com.google.appengine.api.users.User")
public interface UserProxy extends ValueProxy {
  String getNickname();

  String getEmail();
}


MagusDrk

unread,
Oct 29, 2011, 9:33:44 AM10/29/11
to google-we...@googlegroups.com
Hi patrick, Thanks for your quick answer. 

If I understand you, what I have to do is to build my own logical/persisted model in server side and expose it via ValueProxy in the client side?  ValueProxy lets me to send model via RCP? to use that proxy means to build twice the same model (I mean, "world model")? How can I model owned relationships whit this method?

I have to mension I'm new with GWT and GAE, so I think I have to discover lots of information about them. I'd like you to please gime some reference about GWT+GAE integration, of course, RPC, specially best practices, arquitectures and some examples. (as getting started with RequestFactory you send).

Right now, I had to change my project's model to avoid using key class, and I have time requirements, so, right now it's not posible to recreate my model based on proxy, even, I'm really interested in learn as much as posible about GWT, GAE, RCP and all the framework.

Thanks a lot again by your answers.

PDT: ingnore, please, my spelling mistakes, I had a lot of time without using english, ;)

Brandon Donnelson

unread,
Oct 31, 2011, 11:08:12 AM10/31/11
to google-we...@googlegroups.com
I have found no issues with using GWT with GAE and have tried a multitude of ways. I just setup a demo using RequestFactory, JDO and I've showed how to used owned collections of another entity. 


You'll find key serialization and owned collection use there. Now I haven't made every possible use in my demo, but using key serialization in RequestFactory vai a StringId, you can do about anything you want. 

Hope that helps,
Brandon Donnelson

MagusDrk

unread,
Nov 3, 2011, 10:08:39 AM11/3/11
to Google Web Toolkit
Brandon, Thanks, I find your demo very usefull. I'll be referencing it
in my job.

Brandon Donnelson

unread,
Nov 3, 2011, 5:26:29 PM11/3/11
to google-we...@googlegroups.com
Thanks. :)

MagusDrk

unread,
Dec 15, 2011, 5:33:23 PM12/15/11
to Google Web Toolkit
Hi, Patrick.

I'm improving with RequestFactory as succesfully. I have a question
about datastore.Key (again), The correct way to expose it to a client
side is with KeyFactory (keyToString...)? I've tried to use
@ProxyForName(value = "com.google.appengine.api.datastore.Key") public
interface KeyProxy extends ValueProxy {...} but I'm not sure it works
(actually it looks like is not working). what you think? a little
help, please.

=====================================================
@ProxyForName(value = "com.google.appengine.api.datastore.Key")
public interface KeyProxy extends ValueProxy {
long getId();
String getKind();
String getName();
String getNamespace();
KeyProxy getParent();
boolean isComplete();
}

MagusDrk

unread,
Dec 16, 2011, 9:44:38 AM12/16/11
to Google Web Toolkit
Hi All. Again me.

I'm trying to use RequestFactory, now I have to use some domain
methods, for example an myDomainClass.contains(anotherDomainClass).
this is a method created on the domian data class, but I need to to
this check in the client side. I've tried to use a
myDomainClassProxy.contains(anotherDomainClassProxy) method, but I've
got a "only getters and setter allowed" message.

Please, I'm really confused on how to use RequestFactory / Domain
Classes and Its methods from client side.

Thanks a lot! I hope a quick answer.

Reply all
Reply to author
Forward
0 new messages