I am working with Realm ORM for my application. My Application has three Model classes that extends RealmObject. In one of the class I have defined a List of object which is creating problem. my first class;
public class Party extends RealmObject implements Parcelable{
public String name;
public String name_en;
public String name_ne;
public String address;
public String phoneNumber;
//get and setters
//parceable
}
My second class;
public class CreatePurchaseOrderRow extends RealmObject implements Parcelable {
public String name;
public float amount;
public String specification;
public String remarks;
public Party party;
// getter setter
//parceable
}
And finally My third class implements List of objects of Second class. that is,
public class CreatePurchasOrder extends RealmObject implements Parcelable {
public int num;
public Date date;
public List<CreatePurchaseOrderRow> createPurchaseOrderRows;
//getter setter
//parceable
}
the List feeds is creating problem.
i have the screenshot for error message here
Realm is not schemaless database. I tried finding the solutions but i cannot. Can anyone help me with this? Thanks in Advance
RealmObjects can not have fields of type List<>
(java.util.List
), you have to use RealmList<>
instead:
public class CreatePurchasOrder extends RealmObject implements Parcelable {
public int num;
public Date date;
public RealmList<CreatePurchaseOrderRow> createPurchaseOrderRows;
//getter setter
//parceable
}
See also: https://realm.io/docs/java/latest/#many-to-many
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With