I have entities:
@Entity
public class A {
@PrimaryKey(autoGenerate = true)
public long id;
public A() {}
}
@Entity()
public class B {
@PrimaryKey @NonNull
public String id;
public String oneCId;
public String anotherCId;
public long aId;
public B() {}
}
@Entity
public class C {
@PrimaryKey @NonNull
public String id;
public String value;
public C() {}
}
and some POJOs:
public class AWithB {
@Embedded
public A a;
@Relation(parentColumn = "id", entityColumn = "aId")
public List<BWithC> bWithC;
public AWithB() {}
}
public class BWithC {
@Embedded
public B b;
public C oneC;
public C anotherC;
public BWithC() {}
}
with DAO:
@Query("SELECT * FROM a")
List<AWithB> getAllNow();
The problem is with the @Relation for AWithB as it cannot point to anything else than entity. But that entity cannot include other entities. How should I return the whole structure from DB?