Actually I am clear with how to use inner jsonArray with Room persistence library. POJO class as follows:
@Entity(tableName = "customer")
public class CustomerResponseModel {
@PrimaryKey
@ColumnInfo(name = "version")
@SerializedName("version")
private int version;
@ColumnInfo(name = "sync_date")
@SerializedName("sync_date")
private long syncDate;
@Relation(parentColumn = "version", entityColumn = "customerId", entity = CustomerList.class)
private List<CustomerList> customerList;
}
@Entity
public class CustomerList {
@PrimaryKey
@SerializedName("customer_id")
private String customerId;
@SerializedName("customer_type")
private String customerType;
@SerializedName("customer_name")
private String customerName;
@SerializedName("customer_addresses")
@Relation(parentColumn = "customerId", entityColumn = "id", entity = CustomerAddress.class)
private List<CustomerAddress> customerAddresses;
}
@Entity
public class CustomerAddress {
@PrimaryKey(autoGenerate = true)
private int id;
@SerializedName("address")
private String address;
@SerializedName("contact")
private String contact;
}
Error:(15, 8) error: Entities cannot have relations.