Reputation: 1954
I tried to add ActiveAndroid to my first Android app. No errors so far, my items are being saved (I checked it with an sqlite manager) but no matter what query I use the result is always empty. I only have one model (Todo) and only strings, booleans and one date to be saved. (see below)
I use Android 6.0 SDK 23 with Genymotion emulator and ActiveAndroid 3.0.
What I tried:
ArrayList<Model> list = Model.all(Todo.class);
ArrayList<Model> list = new Select().from(Todo.class).execute();
Todo item = return new Select().from(Todo.class).where("id = ?", 1).executeSingle();
The size of the lists is always 0 and item (when searching for one item) is always null. I get no errors.
Any ideas?
Here is my model:
package xyz.tdoo.model;
import *
@Table(name = "Todos")
public class Todo extends Model {
@Column(name = "name")
public String name;
@Column(name = "description")
public String description;
@Column(name = "done")
public Boolean isDone = false;
@Column(name = "favourite")
public Boolean isFavourite = false;
@Column(name = "duedate")
public Date dueDate;
public Todo(String name) {
super();
this.name = name;
}
public static ArrayList<Todo> findAll() {
return new Select().from(Todo.class).execute();
}
public static Todo findOne(int id){
return new Select().from(Todo.class).where("id = ?", id).executeSingle();
}
}
Upvotes: 2
Views: 519