GWT Editors and GAE Datastore

GWT has a Framework Editor that, after a quick look, looks very awful as Spring MVC / Forms handles data binding between database data objects and the user interface.

I am writing my first GWT / GAE application and wondered if there is any way to use this Framework with the GAE JDO / Atomic library, which is the API that you code against O / R between your application and the underlying data store.

Are these two frameworks free or mutually exclusive? If they can work together, maybe someone will ask for a small code example, how could I use them to fill in, say, an HTML <select> field with a list of names or something else basic, but still practical.

I would suggest that this could include a Person POJO representing the person (and having the String name property), perhaps some kind of PersonDAO that uses JDO / Atomic instances for CRUD Person to / from the data store, and then some Editor<Person> , which can display Person instances for the <select> s interface.

If I can see a working example, I think that all of this will be for me. And, if they are not connected to each other and cannot be used together, then a solid explanation of why it would be extremely appreciated! Thanks in advance!

+7
source share
2 answers

Hope this helps, this is an example of code that stores data in the GAE data store, a simple request to get the data and populate the GWT drop-down list with content.

Here is the JDO ORM that is stored in the application engine data store:

https://github.com/bsautner/com.nimbits/blob/master/nimbits-tds/src/com/nimbits/server/orm/EntityStore.java

Here is an example of a datastore request for a list of objects

 @Override public List<Entity> getEntityByName(final User user, final String name) { final PersistenceManager pm = pmf.getPersistenceManager(); try { final Query q1 = pm.newQuery(EntityStore.Class); final List<Entity> c; q1.setFilter("name==b"); q1.declareParameters("String b"); q1.setRange(0, 1); c = (List<Entity>) q1.execute(name); if (c.isEmpty()) { return Collections.emptyList(); } else { final Entity result = c.get(0); return createModel(user, result); } } finally { pm.close(); } } 

Here is a GWT (GXT) combo box that is populated by a POJO created using the ORM model

https://github.com/bsautner/com.nimbits/blob/master/nimbits-tds/src/com/nimbits/client/ui/controls/EntityCombo.java

+1
source

In the era of IE6 and HTML4, it wasn’t possible to write web applications as cool as GMail. That is why GWT was introduced and the goal was achieved: GMail was able to work in any browser.

These days, the GWT seems to have lost its lead. jQuery has become more popular because it uses hardware acceleration and is much faster ... However, it's too early to forget about GWT.

If you want to use the editor environment and JDO, we must emphasize that there is a bottle neck between them: GWT RPC. RPC serializes and deserializes POJOs every time, and you have very limited options for setting serialization / deserialization.

This flaw in the GWT RPC forces most developers to maintain two identical POJO hierarchies: one for JDO / Hibernate and one for GWT. Bosses usually approve of this decision because it is faster and easier than hacking every RPC call to make it work. And in most of the real projects I've seen, there are two hierarchies ...

JQuery, on the other hand, does not require a POJO definition at all. Obviously, this is the reason for the difference in the rate of development.

I'm sorry that I did not answer. I hope my thoughts will be useful, even if it's just that you are at a dead end. And I have already seen several times that very experienced architects decided to use GWT and got to this dead end. And now they are paying for this error, spending time and money writing down two identical POJO hierarchies.

0
source

All Articles