Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Realm database - field of type x is not supported

im working with realm in android and im getting this error message: error: Field "items" of type "java.util.List" is not supported.

it's at this line:

private List<Item> items;

here is the class:

public class Article extends RealmObject implements Serializable{

@PrimaryKey
private String category;
private List<Item> items;

public String getCategory() {
    return category;
}

public void setCategory(String category) {
    this.category = category;
}

public List<Item> getItems() {
    return items;
}

public void setItems(List<Item> items) {
    this.items = items;
}

}

can anybody help me?

like image 348
Lucas Navarro Avatar asked Jun 21 '18 02:06

Lucas Navarro


1 Answers

Unfortunately RealmDatabase doesn’t support List<>. But you can achieve the same result by Using RealmList :)

Realm supports subclasses of RealmObject and RealmList to model relationships.

From: https://realm.io/docs/java/latest

like image 100
Ney Moura Avatar answered Oct 19 '22 20:10

Ney Moura