I am trying to get an object in App Engine with Objectify v4, but it does not work.
- My @Entity: Translation.class
- @Id @Entity I want to get: 301L
My @Entity:
@Entity public class Translation { @Id private Long id; private String text; public String getText() { return text; } public Long getId() { return id; } public void setText(String text) { this.text = text; } }
A query that does not contain a word:
Translation translation =ObjectifyService.ofy().load().type(Translation.class).id(301L).get(); // translation is null
But if I do this:
Translation translation = ObjectifyService.ofy().load().type(Translation.class).first().get(); // translation is not null
Then:
System.out.println(translation.getId());
Thus, fetching by id does not work. Where is the problem?
source share