I have these classes:
@Entity
public class Person {
long id;
String name;
}
@Entity
public class Dog {
long id;
String color;
long idPerson;
}
public class PersonWithDog {
@Embedded
Person person;
@Relation(parentColumn = "id", entityColumn = "idPerson", entity = Dog.class)
List<Dog> dogs;
}
I want to make a query to return a person and a list of only black dogs he owns. Something like:
SELECT * FROM Person
LEFT JOIN Dogs ON Person.id = Dogs.idPerson
WHERE Person.id = ? AND Dogs.color = black
Is this possible using Room?
**Note: If I make a POJO this way:
public class PersonWithDog {
@Embedded
Person person;
@Embedded
List<Dog> dogs;
}
and use the above query, Room won't find out how to map the fields of List, as it doesn't accept an embedded list...