java - Google App Engine Getting Object by the Key -
i stuck geting persisted object id. getting error:
com.google.appengine.api.datastore.entitynotfoundexception: no entity found matching key: cng("t78") i persist object below data store:
key cngkey = keyfactory.createkey("cng", jsoncng.cngid); entity cngentity = new entity("cng", cngkey); cngentity.setproperty("cng_name", jsoncng.cngname); cngentity.setproperty("cng_type", jsoncng.cngtype); cngentity.setproperty("cng_content", cng); here cng json string. set key string: cngid. trying use same id object.
key cngkey = keyfactory.createkey("cng", "t78") and end getting above error.
the constructor new entity("cng", cngkey) defining entity kind , parent key. when try retrieve not provide parent key: keyfactory.createkey("cng", "t78"). not work - must either provide parent key in both places on not.
note - defining entity parent used when defining entity groups, in turn important when using transactions. did not want that?
instead should use new entity(cngkey).
Comments
Post a Comment