Using GWT and JDO, why does execute query always return null? -


i have been working gwt last couple of months , last thing need work storing applications data in jdo-objects gae instead of sqlite.
application saves object (in case forum topic) datastore (i have confirmed in appspot/appengine log viewer). have managed fetch 1 of objects when hard-code topic id this:

 pmanager.getobjectbyid(topic.class, 1); 

but when try use query class , fetch list topics execute method null. if clear datastore of topics can print size of resulting list (hence should not null) when there topics in datastore makes list<topic> null.

here code in question:

// fetches topic-objects app engine storage ,  // puts them in arraylist returned. public arraylist<topic> getalltopics() {      arraylist<topic> queryresults = new arraylist<topic>();     persistencemanager pmanager = pmf.get().getpersistencemanager();     pmanager.getfetchplan().setgroup(fetchgroup.all);     query topicquery = pmanager.newquery(topic.class);      // not make difference query use     //query topicquery = pmanager.newquery(topic.class);      topic newtopic = null;     try {         system.out.println("will try execute query...");         list<topic> results = (list<topic>)topicquery.execute();         system.out.println("result size: " + results.size());         system.out.println("query done executing.");         (topic t : results) {             // not seem make difference either             //      newtopic = pmanager.detachcopy(t);             //      queryresults.add(newtopic);             queryresults.add(t);         }         // can fetch 1 topic when hard-coding id.         //      queryresults.add(pmanager.getobjectbyid(topic.class, 1));     } catch(exception e) {         system.out.println("exception when getting topics on server: " + e.getmessage() + " - ");         system.out.print( e.getstacktrace());     } {         topicquery.closeall();         pmanager.close();     }          return queryresults; } 

and here code makes topic objevts persistant:

    // creates topic object , stores in app engine // returns true if succeeded, otherwise false public boolean createtopic(string title_, string text_) {      persistencemanager pmanager = pmf.get().getpersistencemanager();     userauthimpl newuserauth = new userauthimpl();      if(newuserauth.returnuser().isempty() || newuserauth.returnuser() == null )          return false;      topic newtopic = new topic(newuserauth.returnuser(), title_, text_, new date(calendar.getinstance().gettimeinmillis()));      try {         // did not help: pmanager.setdetachalloncommit(true);         pmanager.makepersistent(newtopic);     } catch(exception e) {         system.out.println("error while creating topic: " + e.getmessage());         return false;     } {         pmanager.close();     }     return true; } 

and here topic object class:

package se.biffnet.tddi15.forum.client;  import java.io.serializable;  import java.util.date;  import javax.jdo.annotations.idgeneratorstrategy; import javax.jdo.annotations.identitytype; import javax.jdo.annotations.persistencecapable; import javax.jdo.annotations.persistent; import javax.jdo.annotations.primarykey;  @suppresswarnings("serial") @persistencecapable(identitytype = identitytype.application, detachable = "true") public class topic implements serializable {  @primarykey @persistent(valuestrategy = idgeneratorstrategy.identity) long    topicid;  @persistent string  authorid;  @persistent string  posttitle;  @persistent string  posttext;  @persistent date    postdate;  public topic(string authorid_, string posttitle_, string posttext_,          java.util.date date) {     authorid    = authorid_;     posttitle   = posttitle_;     posttext    = posttext_; }  public topic() {     authorid    = "";     posttitle   = "";     posttext    = "";     postdate    = null; }  public string getposttitle() {     return posttitle; }  public void setposttitle(string posttitle) {     this.posttitle = posttitle; }  public string getposttext() {     return posttext; }  public void setposttext(string posttext) {     this.posttext = posttext; }  public long gettopicid() {     return topicid; }  public string getauthorid() {     return authorid; }  public date getpostdate() {     return postdate;     }  } 

so guess question is:
why execute() return null? appreciated =)

edit2: had change logging.properties able see debug messages. bad. log large post here, here link pastebin: http://pastebin.com/cgx1aug0

edit3: exception , stacktrace:

java.lang.nullpointerexception: null com.google.appengine.datanucleus.query.queryentitypkfetchfieldmanager.fetchlongfield(queryentitypkfetchfieldmanager.java:74) org.datanucleus.identity.identityutils.getapplicationidentityforresultsetrow(identityutils.java:101) com.google.appengine.datanucleus.entityutils.entitytopojo(entityutils.java:1011) com.google.appengine.datanucleus.query.datastorequery$2.apply(datastorequery.java:229) com.google.appengine.datanucleus.query.datastorequery$2.apply(datastorequery.java:226) com.google.appengine.datanucleus.query.lazyresult.resolvenext(lazyresult.java:96) com.google.appengine.datanucleus.query.lazyresult$lazyabstractlistiterator.computenext(lazyresult.java:229) com.google.appengine.datanucleus.query.abstractiterator.trytocomputenext(abstractiterator.java:131) com.google.appengine.datanucleus.query.abstractiterator.hasnext(abstractiterator.java:126) com.google.appengine.datanucleus.query.lazyresult$abstractlistiterator.hasnext(lazyresult.java:183) se.biffnet.tddi15.forum.server.dbhandlerimpl.getalltopics(dbhandlerimpl.java:75) sun.reflect.nativemethodaccessorimpl.invoke0(native method) sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) java.lang.reflect.method.invoke(method.java:601) com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.method_$1.run(method_.java:167) java.security.accesscontroller.doprivileged(native method) com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.method_.privilegedinvoke(method_.java:164) com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.method_.invoke_(method_.java:125) com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.method_.invoke(method_.java:43) com.google.gwt.user.server.rpc.rpc.invokeandencoderesponse(rpc.java:561) com.google.gwt.user.server.rpc.remoteserviceservlet.processcall(remoteserviceservlet.java:208) com.google.gwt.user.server.rpc.remoteserviceservlet.processpost(remoteserviceservlet.java:248) com.google.gwt.user.server.rpc.abstractremoteserviceservlet.dopost(abstractremoteserviceservlet.java:62) javax.servlet.http.httpservlet.service(httpservlet.java:637) javax.servlet.http.httpservlet.service(httpservlet.java:717) org.mortbay.jetty.servlet.servletholder.handle(servletholder.java:511) org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1166) com.google.apphosting.utils.servlet.parseblobuploadfilter.dofilter(parseblobuploadfilter.java:125) org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) com.google.apphosting.runtime.jetty.savesessionfilter.dofilter(savesessionfilter.java:35) org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) com.google.apphosting.utils.servlet.jdbcmysqlconnectioncleanupfilter.dofilter(jdbcmysqlconnectioncleanupfilter.java:57) org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) com.google.apphosting.utils.servlet.transactioncleanupfilter.dofilter(transactioncleanupfilter.java:43) org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) org.mortbay.jetty.servlet.servlethandler.handle(servlethandler.java:388) org.mortbay.jetty.security.securityhandler.handle(securityhandler.java:216) org.mortbay.jetty.servlet.sessionhandler.handle(sessionhandler.java:182) org.mortbay.jetty.handler.contexthandler.handle(contexthandler.java:765) org.mortbay.jetty.webapp.webappcontext.handle(webappcontext.java:418) com.google.apphosting.runtime.jetty.appversionhandlermap.handle(appversionhandlermap.java:266) org.mortbay.jetty.handler.handlerwrapper.handle(handlerwrapper.java:152) org.mortbay.jetty.server.handle(server.java:326) org.mortbay.jetty.httpconnection.handlerequest(httpconnection.java:542) org.mortbay.jetty.httpconnection$requesthandler.headercomplete(httpconnection.java:923) com.google.apphosting.runtime.jetty.rpcrequestparser.parseavailable(rpcrequestparser.java:76) org.mortbay.jetty.httpconnection.handle(httpconnection.java:404) com.google.apphosting.runtime.jetty.jettyservletengineadapter.servicerequest(jettyservletengineadapter.java:146) com.google.apphosting.runtime.javaruntime$requestrunnable.run(javaruntime.java:438) com.google.tracing.tracecontext$tracecontextrunnable.runincontext(tracecontext.java:480) com.google.tracing.tracecontext$tracecontextrunnable$1.run(tracecontext.java:487) com.google.tracing.tracecontext.runincontext(tracecontext.java:774) com.google.tracing.tracecontext$dointracecontext.runincontext(tracecontext.java:751) com.google.tracing.tracecontext$abstracttracecontextcallback.runininheritedcontextnounref(tracecontext.java:342) com.google.tracing.tracecontext$abstracttracecontextcallback.runininheritedcontext(tracecontext.java:334) com.google.tracing.tracecontext$tracecontextrunnable.run(tracecontext.java:484) com.google.apphosting.runtime.threadgrouppool$poolentry.run(threadgrouppool.java:251) java.lang.thread.run(thread.java:722) 


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -