I have a Room database with a many to many relatio...
# room
p
I have a Room database with a many to many relationship between BusStops and Lines
Copy code
@Entity(tableName = "BusStops")
data class BusStopEntity(
    @PrimaryKey val id: Int = 0,
    val name: String,
    val lat: Double,
    val lon: Double
)

@Entity(tableName = "Lines")
data class LineEntity(
    @PrimaryKey val id: Int = 0,
    val name: String
)

@Entity(primaryKeys = ["busStopId", "lineId"])
data class BusStopLineEntity(
    val busStopId: Int,
    val lineId: Int
)
I use this data class to have the relationship:
Copy code
data class LineWithBusStops(
    @Embedded val line: LineEntity,
    @Relation(
        parentColumn = "id",
        entityColumn = "busStopId",
        associateBy = Junction(BusStopLineEntity::class)
    )
    val busStops: List<BusStopEntity>
)
But I get an error on the
@Relation
line
entityColumn = "busStopId"
> Cannot find the child entity column
busStopId
in com.local.model.BusStopEntity. Options: id, name, lat, lon If I change
busStopId
to
id
, I got even more errors. Any ideas?