我正在尝试查询数据库以获取所有Tree
个对象但是会引发错误:Failed to read row 0, column -1 from a CursorWindow which has 1021 rows, 15 columns.
Model
:
@Table(name = "TreeDetails")
public class Tree extends Model {
public Tree(){
//Mandatory Empty Constructor
super();
}
@Column(name = "ScientificName")
public String scientificName;
public String getScientificName() {
return scientificName;
}
public static List<Tree> getAll(){
return new Select()
.from(Tree.class)
.orderBy("ScientificName Asc")
.execute();
}
}
在Fragment
:
public void getTrees(){
Log.e(TAG, "get trees");
List<Tree> trees = Tree.getAll();
}
为什么我收到此错误。数据库中有15列,但我只需要1.列的拼写是ScientificName
。