You can check out Twig or Objectify which all aim to do what you are asking about.

Twig is higher level - more like an Object database built on top of the datastore in which you use the native low-level Queries. Objectify is more low level in that you handle relationships between objects manually with Keys but has great docs. Both make use of generics to make your code more maintainable.

http://code.google.com/p/twig-persist/

On 2 Feb 2010, at 18:08, Alexandru Farcas wrote:

Is there a way of converting dynamically an Entity to a specific
Object ?
For example:
I have some Contact objects and User, Invoice etc, witch are
PersistanceCapable.
So i can make queries (javax.jdo.Query) that return lists of those
kind of objects (Contact, User, Invoice etc) or i can use app engine
datastore.Query to get lists of Entity objects.
1. Is there a simple method of converting an Entity object to a
Contact for example? but without doing smth like :
       map = entitiy.getProperties();
       Contact c = new Contact();
       c.setProperty1(map.get("property1"));
       c.setProperty2(....)
       ... etc

     I want to know this because i want to use Query from the
datastore package and not javax.jdo and it doesn't seem a good
solution to make a method for each kind of entity. (I could use java
reflection to create the objects, but i think it is very complicated
since i don't know for example the types of fields and it is probably
a costly method).

2. Is the Query class form app engine datastore package more powerful
(or more suited) than the one from javax.jdo? Witch would you
recommend ?

--
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-java@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 .


--
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