我有三个解析子类:Recipe,Ingredient和RecipeIngredient。 RecipeIngredient有一个指向食谱的指针和一个指向成分的指针。ParseQueryAdapter键匹配为空Android
当我试图创建一个QueryFactory来获取配方的所有成分。我试图用whereMatchesKeyInQuery来做到这一点,但objectIds不匹配。从文档看来,这应该是合法的。我错过了什么?
public MeatIngredientListAdapter(Context context, final String recipeName) {
super(context, new ParseQueryAdapter.QueryFactory<Ingredient>() {
public ParseQuery<Ingredient> create() {
ParseQuery<Ingredient> query = ParseQuery.getQuery(Ingredient.class);
query.whereEqualTo("isMeatOrFat", true);
ParseQuery<RecipeIngredient> riQuery = ParseQuery.getQuery(RecipeIngredient.class);
riQuery.whereEqualTo("recipeName", recipeName);
riQuery.include("ingredient");
riQuery.whereEqualTo("isMeatOrFat", true);
query.whereMatchesKeyInQuery("objectId", "ingredient.objectId", riQuery);
return query;
}
});
}
你能解释子查询的目的吗?我不清楚食谱配料应该做什么,以返回成分 – cYrixmorten