I'm having a similar issue where entityManager.remove(entity) does not
actually delete the data from the DB. Because of that I too reverted
to using a sql delete statement. I however am receiving a different
error:

String sql = "DELETE FROM "+Team.class.getName()+" t where t.id
= :id";
                        Query query = entityManager.createQuery(sql);
                        query.setParameter("id", team.getId());
                        query.executeUpdate();

throws:Caused by: java.lang.ClassCastException:
org.datanucleus.store.appengine.query.StreamingQueryResult
        at org.datanucleus.jpa.JPAQuery.executeUpdate(JPAQuery.java:119)

I don't mean the hijack the thread, I just was hoping that someone
could explain to us why entityManager.remove() does not actually
remove the object.

On Aug 12, 5:12 am, ray <[email protected]> wrote:
> Hi Jason,
>
> I am using 1.2.2 and I am having the same problem. At first I fetch
> the entity first by its key but it's in fact never deleted, so I turn
> to using "delete from xx". Any document for this?
>
> Thanks,
> Ray
>
> On Jul 25, 7:53 am, "Jason (Google)" <[email protected]> wrote:
>
>
>
> > Hi Sven. Which version of the SDK are you using?
> > - Jason
>
> > On Thu, Jul 23, 2009 at 10:34 PM, Sven Haiges 
> > <[email protected]>wrote:
>
> > > Hi all,
>
> > > I am trying to delete some entities with this:
>
> > >         jpaTemplate.execute( { entityManager ->
> > >                 def query = entityManager.createQuery("delete from
> > > org.groovytweets.Reply reply where reply.replyCount < 5")
> > >                 count = query.executeUpdate()
> > >             } as JpaCallback )
>
> > > Unfortunately I get an exception:
>
> > > Uncaught exception from servlet
> > > org.codehaus.groovy.runtime.InvokerInvocationException: 
> > > java.lang.ClassCastException: 
> > > org.datanucleus.store.appengine.query.StreamingQueryResult cannot be cast 
> > > to java.lang.Long
>
> > >    at 
> > > com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionF
> > >  ilter.java:35)
> > >    at 
> > > com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(Trans
> > >  actionCleanupFilter.java:43)
> > >    at 
> > > com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionH
> > >  andlerMap.java:237)
>
> > >    at 
> > > com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequ
> > >  estParser.java:76)
> > >    at 
> > > com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceReques
> > >  t(JettyServletEngineAdapter.java:139)
>
> > >    at 
> > > com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:23
> > >  5)
> > >    at 
> > > com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequ
> > >  est(RuntimePb.java:4823)
> > >    at 
> > > com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequ
> > >  est(RuntimePb.java:4821)
>
> > >    at 
> > > com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingAp
> > >  plicationHandler.java:24)
> > >    at 
> > > com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:359)
> > >    at com.google.net.rpc.impl.Server$2.run(Server.java:820)
>
> > >    at 
> > > com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java:5
> > >  6)
> > >    at 
> > > com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceSpa
> > >  nBuilder.java:516)
> > >    at com.google.net.rpc.impl.Server.startRpc(Server.java:775)
>
> > >    at com.google.net.rpc.impl.Server.processRequest(Server.java:348)
> > >    at 
> > > com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.j
> > >  ava:436)
> > >    at 
> > > com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:319)
>
> > >    at 
> > > com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:290)
> > >    at com.google.net.async.Connection.handleReadEvent(Connection.java:428)
> > >    at 
> > > com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher.j
> > >  ava:762)
>
> > >    at 
> > > com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:207)
> > >    at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:101)
> > >    at 
> > > com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:251)
>
> > >    at 
> > > com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run(JavaRuntime.java:
> > >  374)
> > >    at java.lang.Thread.run(Unknown Source)
> > > Caused by: java.lang.ClassCastException: 
> > > org.datanucleus.store.appengine.query.StreamingQueryResult cannot be cast 
> > > to java.lang.Long
>
> > > The replyCount property in my class is
>
> > > Integer replyCount = 0
>
> > > So I am really not sure where the exception originates... in the query or
> > > later when I try to get the count of the query.
>
> > > Does someone know?
>
> > > Cheers
> > > Sven
>
> > > --
> > > Sven Haiges
> > > [email protected]
>
> > > Yahoo Messenger / Skype: hansamann
> > > Personal Homepage, Wiki & Blog:http://www.svenhaiges.de
>
> > > Subscribe to the Grails Podcast:
> > >http://feeds.grailspodcast.com/grailspodcast
> > >http://www.grailspodcast.com
--~--~---------~--~----~------------~-------~--~----~
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