Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think the that i've found the solution. It seems that every endpoint generated by Google App Engine(GAE) framework has a simple method which check every time that someone is trying to insert or update and a persistant instance, so the fact was every time that i've tried to insert a new student using curl/json without specify de new id for the instance it displayed a error message like this one:</p> <pre><code> "error": { "message": javax.jdo.JDOFatalInternalException: The key value passed to construct a SingleFieldIdentity type \ class javax.jdo.identity.LongIdentity \ for class \ class com.alex.wserver.Student \ is null. \ nNestedThrowables: \ norg.datanucleus.exceptions.NucleusException: the key value passed to construct a SingleFieldIdentity type \ class javax.jdo.identity.LongIdentity \ for class \ class com.alex . wserver.Student \ is null. </code></pre> <hr> <p>so i've solve the problem editing my endpoint class by checking if the new object(sent by curl command and wrapped json format) has a not null id value before even check if the object has been stored before with this code:</p> <pre><code> if(student.getKey() != null){ if (containsStudent(student)) { throw new EntityExistsException("Object already exists"); } } mgr.makePersistent(student); </code></pre> <hr> <p>As far i haven't seen any documentation which can clarify that aspect for me. Also i add, i've spend a lot of time reading the documentation on <a href="https://developers.google.com/appengine/docs/java/datastore/jdo/dataclasses">GAE</a> before trying to figure out what's been happening.</p> <hr> <p>All that made me think that maybe just maybe the GAE documentation is not up to date or probably i havent search enough, so if someone know about. please let me know it and grow the common knowledge. thanks @DataNucleus.</p> <p><strong>NOTE:</strong> "This fork that i've made should not be taked as correct answer, it could be take you to unexpected behavior of your app."</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload