I'm glad that solved your issue. I don't completely understand your follow-up question. StreamingQueryResult is a Java Collection that the DataNucleus plugin uses to return query results. You can return it from your App Engine DAO methods without an issue, but you will run into serialization errors when trying to send it over the wire. Hence, you have to copy it into a serializable Collection such as an ArrayList.
- Jason On Aug 17, 9:51 pm, Zhi Le Zou <[email protected]> wrote: > Jason, many many thanks, the problem is solved. > > And may I know why such an object is StreamingQueryResult returned together > with instances of T2? > > And how is this instance returned? I googled on the web, someone mentioned > this instance is injected into instances of T2 as an additional field, is > this correct? > > Thanks in advance :-) > > 2009/8/18 Jason (Google) <[email protected]> > > > > > Hi Zhile. The execute method returns a StreamingQueryResult instance which > > you can't pass back directly or you'll see the error that you indicated > > above. What you can do is create a new Collection instance (e.g. an > > ArrayList or Vector), iterate through the query results copying each item > > (T2 instance) into the new Collection, and then return that instead. > > You may find the recently added gwtguestbook demo useful. The full source > > is available through Subversion: > > >http://code.google.com/p/googleappengine/source/browse/#svn/trunk/jav... > > > - Jason > > > On Fri, Aug 14, 2009 at 9:46 PM, Zhi Le Zou <[email protected]> wrote: > > >> Hello everyone, > >> I encountered a strange exception when doing datastore query with GWT RPC > >> call. The stack trace is pasted at bottom. > > >> There are two data types involved in the query, both are annotated > >> properly. T1 has several simple properties, while T2 has several simple > >> properties and holds an instance of T1. The query code is below. Does > >> anyone know why such exception is produced? A million thanks in advance > >> :-) > > >> public List<T2> getAllRecords(){ > >> PersistenceManager pm = MyUtil.getPersistenceManager(); // The persistence > >> manager is returned correctly here. > >> try { > >> Query query = pm.newQuery(T2.class); > >> List<T2> allRecords = (List<T2>) query.execute(); > >> return allRecords; > >> } finally { > >> pm.close(); > >> } > >> } > > >> 2009-8-15 4:29:05 com.google.appengine.tools.development.ApiProxyLocalImpl > >> log > >> SEVERE: [1250310545707000] javax.servlet.ServletContext log: Exception > >> while dispatching incoming RPC call > >> com.google.gwt.user.client.rpc.SerializationException: Type > >> 'org.datanucleus.store.appengine.query.StreamingQueryResult' was not > >> included in the set of types which can be serialized by this > >> SerializationPolicy or its Class object could not be loaded. For security > >> purposes, this type will not be serialized. > >> at > >> com.google.gwt.user.server.rpc.impl.StandardSerializationPolicy.validateSerialize( > >> StandardSerializationPolicy.java:83) > >> at > >> com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize( > >> ServerSerializationStreamWriter.java:591) > >> at > >> com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129) > >> at > >> com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.java:146) > >> at > >> com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:530) > >> at com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:573) > >> at > >> com.google.gwt.user.server.rpc.RPC.encodeResponseForSuccess(RPC.java:441) > >> at > >> com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:529) > >> at > >> com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:166) > >> at > >> com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86) > >> 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.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:124) > >> 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:54) > >> at > >> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) > >> at > >> com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:313) > >> 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:205) > >> 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) > > >> com.google.gwt.user.client.rpc.StatusCodeException: The call failed on the > >> server; see server log for details > >> at > >> com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:192) > >> at > >> com.google.gwt.http.client.Request.fireOnResponseReceivedImpl(Request.java:264) > >> at > >> com.google.gwt.http.client.Request.fireOnResponseReceivedAndCatch(Request.java:236) > >> at > >> com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:227) > >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > >> at > >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > >> at > >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > >> at java.lang.reflect.Method.invoke(Method.java:585) > >> at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) > >> at > >> com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:126) > >> at > >> com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:155) > >> at > >> com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:294) > >> at > >> com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:194) > >> at > >> org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117) > >> at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) > >> at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925) > >> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966) > >> at > >> com.google.gwt.dev.SwtHostedModeBase.processEvents(SwtHostedModeBase.java:235) > >> at > >> com.google.gwt.dev.HostedModeBase.pumpEventLoop(HostedModeBase.java:558) > >> at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405) > >> at com.google.gwt.dev.HostedMode.main(HostedMode.java:232) > > >> -- > > >> Kind Regards > >> Zhile > > -- > > Kind Regards > Zhile --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
