The RequestFactory sample apps in GWT 2.1 use JDO and JPA because
these are the Java persistence APIs offered by App Engine; however,
RequestFactory has no dependency on them, and you can use Objectify
instead. RequestFactory won't be able to serialize the Objectify Key
object so you should expose only convenience methods like getParent()
below that know how to map the key to the actual entity. Here's an
example that exposes only RequestFactory-safe methods:
@ProxyFor(ListItem.class)
public interface ListItemProxy extends EntityProxy
{
Long getId();
String getItemText();
void setItemText(String itemText);
void setParent(ItemListProxy editList);
ItemListProxy getParent();
}
@Entity
public class ListItem
{
@Id private Long id;
private String itemText;
@Version
private Integer version;
// Dummy field due to JsonRequestProcessor:1543
transient private ItemList parent;
// Real parent key used by Objectify
@Parent private Key<ItemList> parentKey;
public ListItem()
{
// No-arg constructor required
}
public void setParent(ItemList parent)
{
this.parentKey = new ItemListDao().key(parent);
}
public ItemList getParent()
{
try
{
return new ItemListDao().get(parentKey);
}
catch (EntityNotFoundException e)
{
e.printStackTrace();
}
return null;
}
}
HTH,
/dmc
> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>
--
David Chandler
Developer Programs Engineer, Google Web Toolkit
http://googlewebtoolkit.blogspot.com/