room db can join table a to table b and b to c using relational tables

Try these corrections to you classes:

data class MasterQuery{
 @Embedded var tableA: TableA,
 @Relation(
    parentColumn = "table_a_relation",
    entityColumn = "table_b_details",
    //entity = SubQuery::class) <---- 1. replace this with TableB class
    entity = TableB::class) 
   val subQuery: SubQuery
 }

 //@Entity  <---- 2. You don't need this
 data class SubQuery{
   @Embedded var tableB: TableB,
   @Relation(
    parentColumn = "table_b_relation",
    entityColumn = "table_c_details"
 )
  val tableC: TableC
 }

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top