Hello, I’m trying to connect an android application with Google app engine. I am using Google App Engine Datastore as my “database”. The problem is that I am having difficulties in building entities on the GAE datastore.
I’m using JDO to create my entity and I am following the same code pattern as on code.google.com (http://code.google.com/appengine/docs/java/datastore/jdo/ dataclasses.html). The whole thing runs without error but when I open it on Datastore viewer at http://localhost:8888/_ah/admin, where I’m suppose to see all my entities, none of them are being displayed. Instead I’m receiving the following message: “Datastore has no entities in the Empty namespace. You need to add data programmatically before you can use this tool to view and edit it.” I even tried to store a simple data object in the datastore for the entity I created, but it does not work, so I am confusing whether the entity has been created or not. (http://code.google.com/appengine/docs/java/datastore/jdo/ creatinggettinganddeletingdata.html) Below is my Entity Category import javax.jdo.annotations.IdentityType; import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.PrimaryKey; @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Category{ @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) Long id; @Persistent private String ccode; @Persistent private String cname; public Category(String ccode, String cname){ this.ccode = ccode; this.cname = cname; } public Long getID() { return id; } public void setID(Long id) { this.id = id; } public String getCcode() { return ccode; } public void setCode(String ccode) { this.ccode = ccode; } public String getCname() { return cname; } public void setCname(String cname) { this.cname = cname; } } Here i"m trying to add an object data in Entity category Class PMF import javax.jdo.JDOHelper; import javax.jdo.PersistenceManagerFactory; import javax.jdo.PersistenceManager; import com.google.appengine.api.datastore.Key; import com.google.appengine.api.datastore.KeyFactory; import our.fy.project.Category; public final class PMF { private static final PersistenceManagerFactory pmfInstance = JDOHelper.getPersistenceManagerFactory("transactions- optional"); private PMF() {} public static PersistenceManagerFactory getPersistenceManagerFactory() { return pmfInstance; } public void addCategory(Category c) { PersistenceManager pm = getPersistenceManagerFactory().getPersistenceManager(); c = new Category("abc","xyz"); Key key = KeyFactory.createKey(Category.class.getSimpleName(), "011"); c.setKey(key); try { pm.makePersistent(c); } finally { pm.close(); } } Can anyone help, whether I am missing something or not? 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
