Note that there are some explanatory texts on larger screens.

plurals
  1. POGenerate Automatic Id IdGeneratorStrategy
    text
    copied!<p>I'm using Goole App Engine to Build my REST API, I've already marked my class as <em>PersistenceCapable</em> and also i got defined my <strong>@PrimaryKey</strong> and also marked as <strong>@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)</strong>, also i've already EndPoints generated. but when i type in the terminal window a curl command to insert a new entity or registry it doesn't work. this is the code:</p> <pre><code> @PersistenceCapable(identityType = IdentityType.APPLICATION) class Student{ @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long id; private String studentName; .... .... .... } </code></pre> <hr> <p>this is the curl command and response from my local server. when i try to insert a new entity</p> <pre><code>curl -H 'Content-Type: application/json' -d'{"studentName": "myname"}' htto://localhost:8889/_ah/api/utp/v1/student </code></pre> <hr> <p>and this is the response from the local server.</p> <pre><code>"error" : { "message" : "javax.jdo.JDOFatalInternalException: El valor de llave dado para construir una identidad de SingleFieldIdentity de tipo \"class javax.jdo.identity.LongIdentity\" para la clase \"class com.alex.wserver.Student\" es nulo.\nNestedThrowables:\norg.datanucleus.exceptions.NucleusException: El valor de llave dado para construir una identidad de SingleFieldIdentity de tipo \"class javax.jdo.identity.LongIdentity\" para la clase \"class com.alex.wserver.Student\" es nulo." </code></pre> <p>i've been thinking that id was automatically generated an inserted. but that isn't happening here. Unlike of insert an id together</p> <hr> <ol> <li>are my class wrong?</li> <li>are my POST/json request Ok?</li> </ol> <p>Thanks in advance.</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