Wednesday, 22 January 2020

Room @Relation with composite Primary Key

my question is an extension of this question (also mine :) ) -> Room composite Primary Key link to Foreign Key So, if I have this class:

public class FoodWithIngredients extends Food{

    @Relation(parentColumn = "id", entityColumn = "food_id", entity = 
    Ingredient.class)
    private List<Ingredient> mIngredients;

}

But the PrimaryKey of "Food" table is composite (primaryKeys = {"id", "language_id"}).

How I can make the @Relation returns records where "parentColumn = {"id", "language_id"}, entityColumn = {"food_id", food_language_id}" ?



from Room @Relation with composite Primary Key

No comments:

Post a Comment