Hi,

I am getting the below exception even when I have the entity with Id 4 for 
the kind X.

Could not retrieve entity of kind X with key X("X(4)")
org.datanucleus.exceptions.NucleusObjectNotFoundException: Could not 
retrieve entity of kind X with key X("X(4)")
at 
com.google.appengine.datanucleus.DatastoreExceptionTranslator.wrapEntityNotFoundException(DatastoreExceptionTranslator.java:61)
at 
com.google.appengine.datanucleus.EntityUtils.getEntityFromDatastore(EntityUtils.java:670)
at 
com.google.appengine.datanucleus.DatastorePersistenceHandler.fetchObject(DatastorePersistenceHandler.java:543)
at 
org.datanucleus.state.JDOStateManager.loadFieldsFromDatastore(JDOStateManager.java:1638)
at org.datanucleus.state.JDOStateManager.validate(JDOStateManager.java:3511)
at org.datanucleus.ObjectManagerImpl.findObject(ObjectManagerImpl.java:3379)
at 
org.datanucleus.api.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1722)
at 
org.datanucleus.api.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1740)
        ...................

Below is the structure of Kind X,

@PersistenceCapable

class X {
@PrimaryKey
 @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
 private Key xId;

 // getter setter for xId and other attributes
}

I am trying to retrieve this using below code,

getX(String id){
PersistenceManager pm = PMF.get().getPersistenceManager();
 ...
 Key k = KeyFactory.createKey(X.class.getSimpleName(), id);
 X x = pm.getObjectById(X.class, k);
 //X x = pm.getObjectById(X.class, id);  // Even this does not work
 return x;
 ...
}

I am sure I am doing some silly and basic mistake here. Can someone out 
here figure out as to what am I doing wrong over here ?

Thanks !


-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to