I\'m new to Android Room. I want to read from a table and also read from a related table. The relationship is pretty common. One table defines instances. The other table defines
waqaslam pointed the way to the solution. He suggested to alias the column names. The additional step is to give the second table a prefix.
public class AnimalWithType {
@Embedded
private Animal animal;
@Embedded(prefix = "type_")
private AnimalType type;
...
The column aliases are long and messy. I hope that someone can find a cleaner way.
@Query("select animal.id, animal.name..., animal_type.id as type_id... from animal join animal_type on (animal.id = animal_type.id)")