I would try removing the entry using the collection.remove and calling makepersistent ...


---
Sriram C
LMTS - System Engineering
Ulticom ( x2639 )



On Apr 1, 2010, at 9:39 AM, Rodrigo Romano <[email protected]> wrote:

Hello everybody.

I trying to delete a entity child in a relationship of 1 to N inside a
for loop.
It looks like when I call the delete command removeDay(j); that is
only a collection.remove(i) in a arrayList the persistent manager
atached to the object is trying to delete it again and then geting the
nullpointerexception.

Please someone help.

Here is the code part:



for (byte j = 0; j < matrDayWeek.length; j++) {
   if (hor.existeWeek(j)) {
       hor.getWeek().removeDay(j);            //HERE I GOT THE ERROR
       DayWeek d = hor.getSemana().getDayWeek(j);
       System.out.println("d = null? = " + d);
//pm.deletePersistent(d); // I DONT KNOW IF SHOULD
USE THIS LINE TO DELETE, BUT IF I USE THIS I GOT ANOTHER ERROR.
       System.out.println("*******Deleting dayWeek [" + j + "]");
   }
}


STACK ERROR IS:

java.lang.NullPointerException
   at
org.datanucleus.store.appengine.DatastorePersistenceHandler.deleteObject( DatastorePersistenceHandler.java:
562)
   at
org.datanucleus.store.appengine.DatastoreFKListStoreSpecialization.removeAt( DatastoreFKListStoreSpecialization.java:
144)
   at
org.datanucleus.store.mapped.scostore.FKListStore.removeAt (FKListStore.java:
525)
   at
org.datanucleus.store.mapped.scostore.AbstractListStore.remove (AbstractListStore.java:
318)
   at org.datanucleus.sco.backed.ArrayList.remove(ArrayList.java:913)
   at horotimo.database.Semana.removeDay(Semana.java:98)
   at
horotimo.server.database.GravaEtapa2Servlet.doPost (GravaEtapa2Servlet.java:
95)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle (ServletHolder.java:
487)
   at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1093)
   at
com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter (ServeBlobFilter.java:
51)
   at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1084)
   at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter (TransactionCleanupFilter.java:
43)
   at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1084)
   at
com.google.appengine.tools.development.StaticFileFilter.doFilter (StaticFileFilter.java:
121)
   at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1084)
   at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
360)
   at
org.mortbay.jetty.security.SecurityHandler.handle (SecurityHandler.java:
216)
   at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
181)
   at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
712)
at org.mortbay.jetty.webapp.WebAppContext.handle (WebAppContext.java:
405)
   at
com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle (DevAppEngineWebAppContext.java:
70)
   at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
139)
   at com.google.appengine.tools.development.JettyContainerService
$ApiProxyHandler.handle(JettyContainerService.java:352)
   at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
139)
   at org.mortbay.jetty.Server.handle(Server.java:313)
at org.mortbay.jetty.HttpConnection.handleRequest (HttpConnection.java:
506)
   at org.mortbay.jetty.HttpConnection
$RequestHandler.content(HttpConnection.java:844)
   at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644)
   at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
   at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
   at
org.mortbay.io.nio.SelectChannelEndPoint.run (SelectChannelEndPoint.java:
396)
   at org.mortbay.thread.BoundedThreadPool
$PoolThread.run(BoundedThreadPool.java:442)

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google- [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 .


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