Hi All,

I am using JPA for saving entity to datastore. 
I am using final version of the GPE and using its auto-generated endpoint 
class to store an entity to datastore.

Here is my code which throws exception.

fooEndpoint.insertFoo(foo);  // throws  nullpointer exception 

java.lang.NullPointerException
at org.datanucleus.api.jpa.JPAEntityManager.find(JPAEntityManager.java:318)
at org.datanucleus.api.jpa.JPAEntityManager.find(JPAEntityManager.java:256)
at com.FooEndpoint.containsFoo(FooEndpoint.java:150)
at com.FooEndpoint.insertFoo(FooEndpoint.java:96)

My entity class is similar with the given example at this 
source: 
https://developers.google.com/appengine/docs/java/datastore/jpa/overview 

Here is the my entity:

@Entity
public class Foo {

@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Key ID;

... // other fields and setters and getters

}


The exception says that "ID" is null. Okay, It is true. But, I expect the 
ID value will assign by app-engine. On the otherside, When I trying to save 
same object using entity manager persist method. It is working. Because, it 
does not check contains or not. 

Why does the auto-generated endpoint class insert method not work? Do I 
need to initialize the key? 

Thank for your time.

-- 
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 google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to