0

를 참조 자 검색 할 때 나는 두 Objectify entities이 참조 된 개체를 얻을 수 없습니다 Object & Category를, 각 Object는 특정 Category이다. 그래서, 엔티티 ObjectCategory 개체에 대한 참조 (Ref)에 추가했지만 내 문제는 내가 datastore에서 Object를 검색 할 때 나는 Ref 선언에 @Load 주석을 추가하고 있지만, 그이 Category가 검색되지 않는 것입니다.Google 앱 엔진은 엔티티

Object 기업의 Category 게터 & 세터는 다음과 같습니다

List<Object> objects = ofy().load().type(Object.class).list(); 

그리고 Category를 검색 할 수있는 명령은 다음과 같습니다 :

@Load Ref<Category> category; 

public Category getCategory() { 
    return category.get(); 
} 

public void setCategory(Category category) { 
    this.category = Ref.create(category); 
} 

객체를 검색하는 데 사용되는 쿼리는

for (Object object : objects) 
    object.getCategory().getName(); 

답변

0

datastore을 삭제하고 data 엔티티를 다시 저장했으며 참조가 잘 작동하는 것 같습니다 (어쩌면 reference을 저장할 때 오류가 있었음).

관련 문제