Adding functions to my Google app engine app made with Java and JDO
Here is my testing app: http://caoscoding.appspot.com
login: admin pass: test
Is an simple app where you insert some data and get开发者_如何学JAVA out a table, of that data, that's all.
I want to add 2 more functions: modify an entry and delete an entry.
How should I write these 2 functions? I don't have any good idea any more..
The orm is JDO, and is all made with java.
Please suggest any idea to do so, or any code snippet. I don't know how to edit, save and put the updated entry in the datastore. And don't know how to delete it either, I am really stuck here.
To edit an entry you would do something like:
PersistenceManager pm = PMF.get().getPersistenceManager();
// some query to retrieve your object/entry
...
// then make the changes you want to your object
....
// then write it back as per below:
pm.makePersistent(myObject);
The call to the persistence manager to delete an entry would similarly be:
pm.deletePersistent(myObject);
精彩评论