This may help http://code.google.com/p/pgae-examples/source/browse/1e/java/ch08/queries/src/queries/JPAQueriesServlet.java
On Jan 26, 6:13 pm, BlueBlood <eagleeye8...@gmail.com> wrote: > Hi there, > I'm a newbie with GAE, I'm using JPA to access datastore and I'm > having a problem querying datastore. > > I have successfully inserted a few record into datastore using JPA but > I can not read them back from datastore. > Following is my code to query datastore. > > ------------------------------------------------------------------ > EntityManager em = EMF.get().createEntityManager(); > Query query = em.createQuery("select t from > com.test.dataschema.User_JPA as t"); > List<User_JPA> result = query.getResultList(); > > ------------------------------------------------------------------ > EMF class definition: > > package com.fineart.dataschema; > import javax.persistence.EntityManagerFactory; > import javax.persistence.Persistence; > > public final class EMF { > > private static final EntityManagerFactory emfInstance = > Persistence.createEntityManagerFactory("transactions- > optional"); > > private EMF() {} > > public static EntityManagerFactory get() { > return emfInstance; > }} > > ------------------------------------------------------------------ > > I would be so grateful if someone help me out. > Thanks. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appeng...@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.