내가 Objectify
가 이미 Load Groups
의 형태 후에 무엇인지 할 수있는 방법을 제공합니다 생각합니다. @Load
주석을 사용하여 올바르게 지적한대로 UserAccounts
의 followingRef
을 자동으로 검색하므로 대부분의 경우 이러한 상황이 발생하지 않습니다.
@Entity
public class UserAccount {
public static class Everything {}
@Id Long id;
@Load(Everything.class) Ref<UserFollowing> followingRef;
}
당신은 다음 하나의 UserAccount 객체를로드하기 위해 다음을 수행 할 수 있습니다 :
당신이 먼저 법인에 다음의 간단한 수정을 적용해야 자신의
followingRef
와
UserAccount
의 목록을로드하기 위해
// Doesn't load followingRef
UserAccount ua = ofy().load().key(userAccountKey).now();
// Does load followingRef
UserAccount ua = ofy().load().group(Everything.class).key(userAccountKey).now();
Similary 당신은 자신의 followinfRef
와 UserAccount
개체의 목록을로드하기 위해이 작업을 수행 :
// In your case you'd do something like
List<UserAccount> accounts = ofy().load()
.type(UserAccount.class)
.group(Everything.class)
.list();
그러면 문제가 해결 될 것입니다. 코드가 컴파일되는지는 모르겠지만 수정하기가 어렵지는 않습니다.
For further reading click here and scroll down to Load Groups section
니스, 감사합니다. 나는 쉬운 해결책을 원했다. – OliverDeveloper