I have rather simple data model TimeSlot -> Subject -> Teacher. My goal is to get a school weekly schedule. So, in SQL it would be SELECT * FROM TimeSlot, Subject, Teacher WHERE TimeSlot.subject_id = Subject.subject_id AND Subject.teacher_id = Teacher.teacher_id. But I need a RecyclerView with cards where are all timeslots with subjects and appropriate teachers. So, the first part is rather simple = the following data class:
data class TimeSlotWithSubjects (
@Embedded val timeSlot: TimeSlot,
@Relation(
parentColumn = "subjectId",
entityColumn = "subject_id"
)
val subjects: List<Subject>
)
But we have no info about teacher here. At the same time I have another data class:
data class SubjectWithTeacher (
@Embedded val subject: Subject,
@Relation(
parentColumn = "teacher_id",
entityColumn = "teacherId"
)
val teachers: List<Teacher>
)
But here I have no info about timeslots. Please suggest an approach how can I get a LiveData list with all needed info?