I have a Many to Many relationship set up on my Room database denoted by the following diagram:
I want to add extra field to "CrossRef" table. My question is how do I go about having DateWithSteaks get this "isCompleted" variable from "CrossRef" table?
@Entity
public class Steak{
@PrimaryKey(autoGenerate = true)
public int id;
public String title;
}
@Entity
public class Date {
@PrimaryKey
public long date;
public Date() {
date = new LocalDate().toDate().getTime();
}
}
@Entity(primaryKeys = {"date", "id"})
public class DateSteakCrossRef {
public long date;
public int id;
public boolean isCompleted;
}
public class DateWithSteaks {
@Embedded Date date;
@Relation(
parentColumn = "date",
entityColumn = "id",
associateBy = @Junction(DateSteakCrossRef.class)
)
public List<Steak> steaks;
}