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

2011-01-24 Thread Stephen Johnson
Hi Marc, As the error message says, you should use a singleton to share your persistence manager. Your code must be allocating it more than once. Here ya go: import javax.jdo.JDOHelper; import javax.jdo.PersistenceManagerFactory; import javax.jdo.PersistenceManager; final public class PMF { p

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

2011-01-24 Thread Stephen Johnson
Try changing Ikai's code to include the entity name like: SELECT * from DB WHERE __key__ = KEY('DB','1') if your key is a number then SELECT * from DB WHERE __key__ = KEY('DB',1) Documentation: an entity key literal, with either a string-encoded key

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

2011-01-24 Thread Marc Herber
Meanwhile I tried this *java* code: PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory( "transactions-optional" ); PersistenceManager pm = pmf.getPersistenceManager(); Antwort objectById = pm.getObjectById( Antwort.class, parameters.getLong( Constants.ID ) ); And this is my *

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

2011-01-24 Thread Marc Herber
Thanks for your help. Unfortunatelly this syntax isn't working at all :( I tried to run this statement within the datastore viewer but I get an error "GQL Query". Apart from that the link you posted is for python, but I would need it for java. Can you/anybody help me with that too? Thanks in ad

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

2011-01-24 Thread Ikai Lan (Google)
Try: SELECT * from DB WHERE __key__ = KEY('1') You can find more documentation on this here: http://code.google.com/appengine/docs/python/datastore/gqlreference.html -- Ikai Lan Developer Programs Engineer, Google App Engine Blogger: http://googleappengine.blogspot.com Reddit: http://www.reddit

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

2011-01-23 Thread herber . marc
Hi all, I'm pretty new using GQL so hopefully someone can help me solving this easy (?) problem. I store my Entities in the DB using datastore.put( Entity ) without using an ID. But if I look at the Datastore Viewer I see that these entities are stored with an unique id called *ID/Name*. Now I