Found the answer,

Have to copy all the contents in the query result to a new list

eg,

projectsTemp = (List<Project>) query.execute();
List<Project> projects = new ArrayList<Project>();
projects.addAll(projectsTemp);
planet.setProjects(projects);


hope this helps




On Apr 20, 4:29 pm, mini998 <[email protected]> wrote:
> Hi, I have the same problem
>
> I think its due to the result set being not serialized
>
> do not know how to serialize the result set before putting it to
> session
>
> any ideas thanks in advance
>
> On Apr 19, 9:52 pm, CodeMan <[email protected]> wrote:
>
>
>
> > Hi,
>
> > I am getting the error below in a JSF app when I try to fetch a
> > List<Template>.
>
> > Using this code:
> >             PersistenceManager pm =
> > PMF.get().getPersistenceManager();//
> >             String query = "select from " + Template.class.getName() + "
> > where owner=='"+owner+"' ";
> >             this.templates = (List<Template>) pm.newQuery(query).execute();
>
> > Can you help figure out what's causing it.
>
> > Thanks.
>
> > #
>
> >    1.
> >       04-19 01:42PM 52.901 /pages/newcbx.faces 500 18322ms 24015cpu_ms
> > 40api_cpu_ms 0kb Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:
> > 1.9.0.17) Gecko/2009122116 Firefox/3.0.17 (.NET CLR
> > 3.5.30729),gzip(gfe)
> >       See details
>
> >       98.229.74.17 - - [19/Apr/2010:13:43:11 -0700] "POST /pages/
> > newcbx.faces HTTP/1.1" 500 0 "http://ezcomment.appspot.com/pages/
> > dusers.faces" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:
> > 1.9.0.17) Gecko/2009122116 Firefox/3.0.17 (.NET CLR
> > 3.5.30729),gzip(gfe)" "ezcomment.appspot.com"
>
> >    2.
> >       W 04-19 01:43PM 02.874
>
> >       [ezcomment/1.341368964543160070].<stderr>: SystemId Unknown;
> > Line #57; Column #31; Failed calling setMethod method
>
> >    3.
> >       W 04-19 01:43PM 03.367
>
> >       [ezcomment/1.341368964543160070].<stderr>: SystemId Unknown;
> > Line #57; Column #31; Failed calling setMethod method
>
> >    4.
> >       W 04-19 01:43PM 11.177
>
> >       /pages/newcbx.faces
> >       java.lang.RuntimeException: java.io.NotSerializableException:
> > org.datanucleus.store.appengine.query.DatastoreQuery$2
> >         at
> > com.google.apphosting.runtime.jetty.SessionManager.serialize(SessionManager 
> > .java:
> > 361)
> >         at
> > com.google.apphosting.runtime.jetty.SessionManager.createEntityForSession(S 
> > essionManager.java:
> > 341)
> >         at com.google.apphosting.runtime.jetty.SessionManager
> > $AppEngineSession.save(SessionManager.java:162)
> >         at
> > com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionF 
> > ilter.java:
> > 41)
> >         at org.mortbay.jetty.servlet.ServletHandler
> > $CachedChain.doFilter(ServletHandler.java:1157)
> >         at
> > com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(Trans 
> > actionCleanupFilter.java:
> > 43)
> >         at org.mortbay.jetty.servlet.ServletHandler
> > $CachedChain.doFilter(ServletHandler.java:1157)
> >         at
> > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
> > 388)
> >         at
> > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
> > 216)
> >         at
> > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
> > 182)
> >         at
> > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
> > 765)
> >         at
> > org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
> >         at
> > com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionH 
> > andlerMap.java:
> > 238)
> >         at
> > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> > 152)
> >         at org.mortbay.jetty.Server.handle(Server.java:326)
> >         at
> > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
> > 542)
> >         at org.mortbay.jetty.HttpConnection
> > $RequestHandler.headerComplete(HttpConnection.java:923)
> >         at
> > com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequ 
> > estParser.java:
> > 76)
> >         at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:
> > 404)
> >         at
> > com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceReques 
> > t(JettyServletEngineAdapter.java:
> > 135)
> >         at
> > com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:
> > 243)
> >         at com.google.apphosting.base.RuntimePb$EvaluationRuntime
> > $6.handleBlockingRequest(RuntimePb.java:5485)
> >         at com.google.apphosting.base.RuntimePb$EvaluationRuntime
> > $6.handleBlockingRequest(RuntimePb.java:5483)
> >         at
> > com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingAp 
> > plicationHandler.java:
> > 24)
> >         at
> > com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:398)
> >         at com.google.net.rpc.impl.Server$2.run(Server.java:852)
> >         at
> > com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java:
> > 56)
> >         at
> > com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceSpa 
> > nBuilder.java:
> > 536)
> >         at com.google.net.rpc.impl.Server.startRpc(Server.java:807)
> >         at com.google.net.rpc.impl.Server.processRequest(Server.java:
> > 369)
> >         at
> > com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.j 
> > ava:
> > 442)
> >         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:474)
> >         at
> > com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher.j 
> > ava:
> > 831)
> >         at
> > com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:
> > 207)
> >         at
> > com.google.net.async.EventDispatcher.loop(EventDispatcher.java:103)
> >         at
> > com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:
> > 251)
> >         at com.google.apphosting.runtime.JavaRuntime
> > $RpcRunnable.run(JavaRuntime.java:404)
> >         at java.lang.Thread.run(Unknown Source)
> >       Caused by: java.io.NotSerializableException:
> > org.datanucleus.store.appengine.query.DatastoreQuery$2
> >         at java.io.ObjectOutputStream.writeObject0(Unknown Source)
> >         at java.io.ObjectOutputStream.writeObject(Unknown Source)
> >         at java.util.ArrayList.writeObject(Unknown Source)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> >         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> > Source)
> >         at java.lang.reflect.Method.invoke(Unknown Source)
> >         at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
> >         at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
> >         at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown
> > Source)
> >         at java.io.ObjectOutputStream.writeObject0(Unknown Source)
> >         at java.io.ObjectOutputStream.defaultWriteFields(Unknown
> > Source)
> >         at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
> >         at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown
> > Source)
> >         at java.io.ObjectOutputStream.writeObject0(Unknown Source)
> >         at java.io.ObjectOutputStream.defaultWriteFields(Unknown
> > Source)
> >         at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
> >         at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown
> > Source)
> >         at java.io.ObjectOutputStream.writeObject0(Unknown Source)
> >         at java.io.ObjectOutputStream.writeObject(Unknown Source)
> >         at java.util.HashMap.writeObject(Unknown Source)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> >         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> > Source)
> >         at java.lang.reflect.Method.invoke(Unknown Source)
> >         at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
> >         at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
> >         at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown
> > Source)
> >         at java.io.ObjectOutputStream.writeObject0(Unknown Source)
> >         at java.io.ObjectOutputStream.writeObject(Unknown Source)
> >         at
> > com.google.apphosting.runtime.jetty.SessionManager.serialize(SessionManager 
> > .java:
> > 358)
> >         ... 39 more
>
> >    5.
> >       C 04-19 01:43PM 11.197
>
> >       Uncaught exception from servlet
> >       java.lang.RuntimeException: java.io.NotSerializableException:
> > org.datanucleus.store.appengine.query.DatastoreQuery$2
> >         at
> > com.google.apphosting.runtime.jetty.SessionManager.serialize(SessionManager 
> > .java:
> > 361)
> >         at
> > com.google.apphosting.runtime.jetty.SessionManager.createEntityForSession(S 
> > essionManager.java:
> > 341)
> >         at com.google.apphosting.runtime.jetty.SessionManager
> > $AppEngineSession.save(SessionManager.java:162)
> >         at
> > com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionF 
> > ilter.java:
> > 41)
> >         at org.mortbay.jetty.servlet.ServletHandler
> > $CachedChain.doFilter(ServletHandler.java:1157)
> >         at
> > com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(Trans 
> > actionCleanupFilter.java:
> > 43)
> >         at org.mortbay.jetty.servlet.ServletHandler
> > $CachedChain.doFilter(ServletHandler.java:1157)
> >         at
> > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
> > 388)
> >         at
> > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
> > 216)
> >         at
> > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
> > 182)
> >         at...
>
> read more »

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