Hi Lu,

One way is for your app to create a task on the task queue at start-
up. This task can iterate through your existing document instances in
the datastore and delete them. (For robustness, you could fetch a few
instances only, and if more exist then get the task to create a new
task to continue the work.)

If this deletion would interfere with instances newly-created, you
could introduce a start-up date-time to the task, so that you query
for document instances older than that (you might have to add a date-
time field to your document class and set it at creation-time (and
possibly edit-time too)).

Enjoy?


On Jun 29, 8:44 am, Lu <chenglu.annal...@gmail.com> wrote:
> Thanks. I've tried it but it is pretty slow if I have to control it
> this way.
>
> The problem I met is when I create an object and its ID is, say 1, if
> I run my application again, the ID becomes 2.
> How can I let my application have refreshed new database everytime?
> Because if it keeps adding the objects, it will exceed the quota
> anyway, isn't it?
>
> Here is my code. Everytime I run my application, 'id' will increment
> by 1.
>
> PersistenceManager pm = PMF.get().getPersistenceManager();
> String title = "welcome";
> document doc = new document(title);
> try{
>         pm.makePersistent(doc);
>         System.out.println("id is "+doc.getID());
>
> }finally{
>         pm.close();
> }

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