I find it difficult to find the list item in the room. The list item is called dimensions and its type is Measurement. the list item does not have a primary key to be associated with the database. but I have no problem adding the same primary key for ProductModel if necessary.
Here is what I still have:
@Entity(tableName = TABLE_NAME)
public class ProductModel {
public static final String TABLE_NAME = "product";
@PrimaryKey
private int idProduct;
private int idCategoryDefault;
@Relation(parentColumn = "idProduct", entityColumn = "idProduct", entity = SortedAttribute.class)
private List<SortedAttribute> sortedAttributes = null;
}
@Entity
public class SortedAttribute {
@PrimaryKey
private int idProduct;
private String reference;
@Embedded
private List<Measurement> measurements = null;
}
public class Measurement {
private String value;
private String valueCm;
public Measurement() {
}
}
source
share