I am trying to use the App Engine Datastore (High Replication Datastore, HRD) and i have to use the low-level API . I never worked with entity database before so I have some problem. I have tried to store some Post and comments, each post can have more comments
I tried this code for Post, but the problem is how to make ID auto-increment ?
Entity post = new Entity("post", ID);
post.setProperty("content", postContent);
post.setProperty("time", timeStamps);
And this code for comment but i don't understand how to use the ancestor to make the relation between the post and the the comment, shall i just add ancestor property and put the ID value on it ?
Entity comment = new Entity("comment", ID);
comment.setProperty("ancestor",postID);
comment.setProperty("content", commentContent);
comment.setProperty("time", timeStamps);
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
datastore.put(comment);