Hi Steve,
Thanks for your reply.
I was curious to check out the new Mapper framework suggested by Ikai.
I was going to give it a try. If that does not work out, I will resort
to the technique you suggested.
Thanks again.
Viji

On Jul 30, 3:22 pm, Steven Speek <[email protected]> wrote:
> DearViji,
> I had the same problem. You walked into the 30 seconds limit.
> What you do is delete a fixed amount of entities and than schedule the
> rest in a task.
> In other words you define a task servlet that deletes say 100 items
> and if there are items left reschedules itself.
> This sounds hard but I hope the code explains 
> more:http://code.google.com/p/fspotcloud/source/browse/server/src/main/jav...
> From there
>   public long deleteAllPhotos() {
>                 Batch batch = batchManager.create("deleteAllPhotos");
>                 long batchId = batchManager.save(batch);
>
>                 Queue queue = QueueFactory.getDefaultQueue();
>                 queue.add(url("/admin/task/
> photoDelete").param("deleteCount", "0")
>                                 .param("batchId",
> String.valueOf(batchId)));
>                 return batchId;
>         }
> this task is called.
> All references to Batch can be discarded. It is for me to see when the
> delete is finished.
> And my code is GNUv3 so feel free.
>
> Kind regards,
> Steven
>
> On 30 jul, 20:45,VijiSarathy <[email protected]> wrote:
>
> > Hi,
>
> > I am trying to programmatically delete a large set of entities from
> > the datastore based on the value of one of the properties of the
> > entity, namely, "asOfDate".
>
> > The Java method that I am using to perform this operation is shown at
> > the end of this message.
> > I have another method that is very similar that tells me the count of
> > the entities for the given parameter.
>
> > The date parameter that I am using is Mar 01, 2010. There are 12032
> > entities whose "asOfDate" property is less than this value. When I
> > invoke the deleteUsageDates method below, the server tries for a while
> > and ultimately gives a 500 error with the following message:
> > "A serious problem was encountered with the process that handled this
> > request, causing it to exit. This is likely to cause a new process to
> > be used for the next request to your application. If you see this
> > message frequently, you may be throwing exceptions during the
> > initialization of your application. (Error code 104)"
>
> > Any idea what I am doing wrong?
> > Thanks,
> >Viji
>
> >         public static boolean deleteUsageDates (Date endDate)
> >         {
> >                 SimpleDateFormat dateFormat = new SimpleDateFormat 
> > ("yyyy-MM-dd");
> >                 String endDateStr = dateFormat.format (endDate);
>
> >                 PersistenceManagerFactory factory = 
> > JdoPersistenceManagerFactory.get
> > ();
> >                 PersistenceManager manager = factory.getPersistenceManager 
> > ();
> >                 try
> >                 {
> >                         Query query = manager.newQuery (UsageHistory.class);
> >                         query.setFilter ("asOfDate < endDateParam");
> >                         query.declareImports ("import java.util.Date");
> >                         query.declareParameters ("Date endDateParam");
> >                         query.deletePersistentAll (endDate);
> >                         return true;
> >                 }
> >                 catch (Exception ex)
> >                 {
> >                         logger.severe (String.format ("Exception while 
> > deleting usage
> > histories before %s; Exception message = %s", endDateStr,
> > ex.getMessage ()));
> >                 }
> >                 return false;
> >         }

-- 
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 [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-java?hl=en.

Reply via email to