Hi Charlie,

What do you mean by "not totally working"? Also, you may have better luck
asking this in the google-appengine-java group.

-Nick Johnson

On Sat, Jun 20, 2009 at 3:36 PM, Charlie Zhu <[email protected]> wrote:

>
> Thank you, Nick,
>
> I have written code as below with low level API to delete the entry.
> It runs without error but seems not totally working. And thanks god
> that data suddenly appeared at Data Viewer and problem resolved.
>
> Code pasted here and hope it useful for others
>
> import com.google.appengine.api.datastore.DatastoreService;
> import com.google.appengine.api.datastore.DatastoreServiceFactory;
> import com.google.appengine.api.datastore.Entity;
> import com.google.appengine.api.datastore.Query;
>
>        public void doGet(HttpServletRequest req, HttpServletResponse resp)
> throws IOException {
>                 String tbname = req.getParameter("tbname");
>                 if(tbname!=null)
>                 {
>                         DatastoreService datastore =
> DatastoreServiceFactory.getDatastoreService();
>
>                         // Or perform a query
>                         Query query = new Query(tbname);
>                         for (Entity taskEntity :
> datastore.prepare(query).asIterable()) {
>                             datastore.delete(taskEntity.getKey());
>                         }
>                 }
>        }
>
>
> Regards,
> Charlie
>
> On Jun 17, 11:58 pm, "Nick Johnson (Google)" <[email protected]>
> wrote:
> > Hi Charlie,
> >
> > Your easiest option here is probably to upload an alternate major version
> of
> > your app with the old schema, and use that to retrieve and fix the faulty
> > entit(y|ies). Alternate approaches include using the low level datastore
> > API, or uploading a Python version that uses the low level API or
> > db.Expando.
> >
> > -Nick Johnson
> >
> >
> >
> >
> >
> > On Wed, Jun 17, 2009 at 9:15 AM, Charlie Zhu <[email protected]>
> wrote:
> >
> > > Hi,
> >
> > > I have tried all ways I known to delete some schema changing caused
> > > error Entities and failed.
> >
> > > 1. Delete on Data Viewer on the console.
> > > Data Viewer shows "No Data Yet."
> >
> > > 2. Delete by code
> > > Below is part of the codes:
> > >        Query q = pm.newQuery(CDKFingerprint.class);
> > >        List<CDKFingerprint> results2;
> > >        results2 = (List<CDKFingerprint>) q.execute();
> > >        pm.deletePersistentAll(results2);
> > > But that cause server error:
> > > java.lang.NullPointerException: Datastore entity with kind
> > > CDKFingerprint and key CDKMol(c=cc=cc=c)/CDKFingerprint(1) has a null
> > > property named bits_count.  This property is mapped to
> > > cdkhelper.CDKFingerprint.bits_count, which cannot accept null values.
> > > ...
> > > at org.datanucleus.jdo.JDOPersistenceManager.deletePersistentAll
> > > (JDOPersistenceManager.java:795)
> > > ...
> >
> > > 3. Assign values to the NULL field then delete
> > > The code
> > >        for(CDKFingerprint r: results2) {
> > >                r.bits_count = 0;
> > >                pm.makePersistent(r);
> > >        }
> > > And server error again
> > > java.lang.NullPointerException: Datastore entity with kind
> > > CDKFingerprint and key CDKMol(c=cc=cc=c)/CDKFingerprint(1) has a null
> > > property named bits_count.  This property is mapped to
> > > cdkhelper.CDKFingerprint.bits_count, which cannot accept null values.
> > > ...
> > > at org.datanucleus.store.appengine.query.StreamingQueryResult
> > > $AbstractListIterator.hasNext(StreamingQueryResult.java:205)
> > > ...
> >
> > > Having no idea and hoping help.
> >
> > > Regards,
> > > Charlie
> >
> > --
> > Nick Johnson, App Engine Developer Programs Engineer
> > Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration
> Number:
> > 368047
> >
>


-- 
Nick Johnson, App Engine Developer Programs Engineer
Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number:
368047

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

Reply via email to