TurboManage

David Chandler's Journal of Java Web and Mobile Development

  • David M. Chandler


    Web app developer since 1994 and former Developer Advocate with Google now residing in Colorado. Besides tech, I enjoy landscape photography and share my work at ColoradoPhoto.gallery.

  • Subscribe

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 241 other followers

  • Sleepless Nights…

    October 2009
    S M T W T F S
    « Sep   Nov »
     123
    45678910
    11121314151617
    18192021222324
    25262728293031
  • Blog Stats

    • 876,139 hits

GWT + GAE and the Balm of GILEAD

Posted by David Chandler on October 15, 2009

My domain model is getting real now and I’ve had to use AppEngine’s Key class in one of my domain objects to model a one-to-many relationship:

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable="true")
public class PrayerList implements Serializable
{
	...
	@Persistent
	private Key listOwner;
	...
}

As has been discussed in several forums, GWT does not emulate any AppEngine classes, so there are a few possible workarounds:

  1. Create a DTO that does not contain any AppEngine classes for each domain object. DTOs, yuck.
  2. Provide an emulated Key class yourself following Fred Sauer’s fine instructions.
  3. Use the GILEAD project’s Adapter4AppEngine, which supplies GWT with emulated classes for AppEngine’s Key, Text, Blob, and other troublesome types.

Without Adapter4AppEngine:

Removing units with errors
 [ERROR] Errors in 'file:/C:/Users/David/workspace/ROA/src/com/roa/client/domain/PrayerList.java'
 [ERROR] Line 12: The import com.google.appengine cannot be resolved
 [ERROR] Line 30: Key cannot be resolved to a type

With Adapter4AppEngine:

Compiling 6 permutations
 Permutation compile succeeded

According to the GILEAD project’s home page,

Gilead stands for Generic Light Entity Adapter

It permits you to send Persistent entities (and especially the partially loaded ones) outside the JVM (GWT, Flex, Web-Services, Google AppEngine …) without pain.

Adapter4AppEngine is simple to use. Just drop in the jar and add the required <inherits> tag in your gwt.xml.

Nice!

Advertisements

3 Responses to “GWT + GAE and the Balm of GILEAD”

  1. Itzik yatom said

    Thank you for your helpful post.

    I have just downloaded the Adapter4AppEngine jar file from here and I see that it has emulation only for Key class and not for Text or Blob.

    Is there a newer version that you use ?

    Itzik

  2. […] so the same annotated domain class can be used on both client and server with GWT-RPC, and Gilead offers something similar for […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: