i am learning how to store and retrieve data with the google app engine and objectify, and set up a test project in intellij-idea. i created a simple entity that looks like this:
ContactType
@Entity
public class ContactType {
@Id
public Long id;
public String name;
public ContactType(String name){
this.name = name;
}
}
before i start testing i delete all saved instances i created before in my servlet:
deleting old data
Objectify ofy = ObjectifyService.ofy();
ObjectifyService.register(ContactType.class);
List<Key<ContactType>> contactTypes = ofy.load().type(ContactType.class).keys().list();
ofy.delete().keys(contactTypes).now();
after that i save this entity like this:
saving new data
ContactType contactType1 = new ContactType("contactType1");
ContactType contactType2 = new ContactType("contactType2");
ofy.save().entity(contactType1 ).now();
ofy.save().entity(contactType2 ).now();
then i retrieve the objects i just saved like this:
retrieving data
List<ContactType> list= ofy
.load()
.type(ContactType.class)
.list();
and get the 2 expected objects. but when i comment out the lines that delete and save the old entries, and just want to retrieve the entries that i saved last time (and which i can still see in the development console), and inspect the returned entries with the intellij-idea debugger, i just get this small error message and no stacktrace in the console at all.:
debugging error message
Unable to evaluate the expression Method threw 'com.googlecode.objectify.LoadException' exception.
and when i change the "view as" option from "list" to "toString" in the intellij-idea debugger i get only following information:
so my questions are:
- how can i save and retrieve data with objectify?
- how can i see a detailed error stacktrace when something goes wrong?
