Re: [appengine-java] Re: Can't fetch a dataset using primary key

2011-01-26 Thread Stephen Johnson
Yes, to use JDO your going to have to annotate the class and have the DataNucleus enhancer run over the classes. If you use the low-level API then you can just query for the Entity object itself. On Wed, Jan 26, 2011 at 3:09 PM, Marc Herber wrote: > Thanks for your hint. Meanwhile I debugged the

Re: [appengine-java] Re: Can't fetch a dataset using primary key

2011-01-26 Thread Marc Herber
Thanks for your hint. Meanwhile I debugged the code and found the reason of the NullPointerException. The method getObjectById is implemented by the class DatastoreJDOPersistenceManager. Within this method there is *EntityUtils.idToInternalKey(getObjectManager(), cls, key, false);*. This metho

Re: [appengine-java] Re: Can't fetch a dataset using primary key

2011-01-26 Thread Marc Herber
I just talked about GQL because within the Datastore Viewer of my dashboard I can enter a GQL-query. That's why I was assuming that "everybody" has to use GQL...my fault. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to

Re: [appengine-java] Re: Can't fetch a dataset using primary key

2011-01-26 Thread Stephen Johnson
Did quick check, Yes, KEY(' ') can be used if what's inside is an encoded key, but I assumed that by a plain 1 it was an unencoded ID value. On Wed, Jan 26, 2011 at 12:00 PM, Stephen Johnson wrote: > Minor minor point :) I believe Ikai if you look at your posted code you > forgot the entity kind

Re: [appengine-java] Re: Can't fetch a dataset using primary key

2011-01-26 Thread Stephen Johnson
Minor minor point :) I believe Ikai if you look at your posted code you forgot the entity kind in your call to KEY, you used KEY('1') without any entity kind stated. I also was assuming he was using datastore viewer which I think he was. Or is this KEY('1') allowed without entity kind allowed?? On

Re: [appengine-java] Re: Can't fetch a dataset using primary key

2011-01-26 Thread Ikai Lan (Google)
Minor point: I posted Python code because you used the term "GQL". I assumed you were working with the datastore viewer - the code sample I posted should be valid there. Java code in JDO uses JDOQL. -- Ikai Lan Developer Programs Engineer, Google App Engine Blogger: http://googleappengine.blogspo

Re: [appengine-java] Re: Can't fetch a dataset using primary key

2011-01-26 Thread Stephen Johnson
Also, check that the PMF.getPersistenceManager() returns a non-null value. Perhaps with the changes you've been trying you don't have the "transactions-optional" name in the config file matching the code. On Wed, Jan 26, 2011 at 11:00 AM, Stephen Johnson wrote: > Well, you shouldn't be getting a

Re: [appengine-java] Re: Can't fetch a dataset using primary key

2011-01-26 Thread Stephen Johnson
Well, you shouldn't be getting a NullPointerException if the entity is not found so something else is wrong. The correct exception would be JDOObjectNotFoundException. Are you sure the PageParameters parameters is not null or something else isn't null?? You don't use the 'a' variable in anyway in t

[appengine-java] Re: Can't fetch a dataset using primary key

2011-01-25 Thread hrbaer
Ok guys, even if the gql query is running I'm still not able to port this logic into my java class. Maybe someone could have a look at my code and correct/refer to my mistake(s): public GuestbookDetails( final PageParameters parameters ) throws StringValueConversionException { Persistence

Re: [appengine-java] Re: Can't fetch a dataset using primary key

2011-01-25 Thread Stephen Johnson
Good to hear! On Tue, Jan 25, 2011 at 5:24 AM, hrbaer wrote: > Both the database query and the PMF singleton are working - thanks! > > -- > 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 > goo

[appengine-java] Re: Can't fetch a dataset using primary key

2011-01-25 Thread hrbaer
Both the database query and the PMF singleton are working - thanks! -- 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 google-appengine-java@googlegroups.com. To unsubscribe from this group, send e