I try to use the new architecture components, but when I try to start, I get:
"Error: (375, 24) Error: there is a problem with the query: SQLID_ERROR] SQL error or missing database (there is no such table: messages)"
Listed below are my classes.
** ENTITY: **
@Entity
public static class Post {
@PrimaryKey
private String id;
@ColumnInfo(name = "data")
private String data;
public String getId() {
return id;
}
public void setData(String data) {
this.data = data;
}
public String getData() {
return data;
}
public void setId(String id) {
this.id = id;
}
}
DAO:
@Dao
public interface PostDao {
@Query("SELECT * FROM posts")
LiveData<List<Post>> getAll();
@Insert
void insertAll(Post... posts);
@Insert
void insert(Post post);
@Delete
void delete(Post post);
}
Database:
@Database(entities = {Post.class}, version = 1)
public static abstract class AppDatabase extends RoomDatabase {
public abstract PostDao postDao();
}
source
share