Google Objectify v4 fetch by id
gwt, objectify
Solution
Since your entity has a `@Parent` field, in order to get it by id, you need to execute:
Translation translation = ObjectifyService.ofy().load().type(Thing.class).parent(par).id(301).get();
For more information take a look at Objectify Basic Operations - Loading
Hope this helps!
Problem
I'm trying to fetch an entity in App Engine with Objectify v4 but it doesn't work. - My @Entity: Translation.class - The @Id of the @Entity I want to fetch: 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; } } ``` The request that doesn't word: ``` Translation translation =ObjectifyService.ofy().load().type(Translation.class).id(301L).get(); // translation is null ``` But if I do: ``` Translation translation = ObjectifyService.ofy().load().type(Translation.class).first().get(); // translation is not null ``` Then: ``` System.out.println(translation.getId()); // translation id equal 301 ``` So the fetch by id doesn't seem to work. Where is the problem?