My @Dao interface is:
@Dao
public interface TaskDao {
@Insert
void insert(Task task);
@Update
void update(Task task);
@Delete
void delete(Task task);
@Query("DELETE FROM task_table")
void deleteAllTasks();
@Query("SELECT * FROM task_table")
LiveData<List<Task>> getAllMainTasks();
}
Using this query every thing works fine and just as wanted. Here is the table screenshot:
Changing the last two lines to below lines causing problem:
@Query("SELECT * FROM task_table WHERE creator_ID = NULL ORDER BY task_ID ASC")
LiveData<List<Task>> getAllMainTasks();
But when I use this, no entry in this table is created!
Try to replace your null-condition:
@Query("SELECT * FROM task_table WHERE creator_ID = NULL ORDER BY task_ID ASC")
to
@Query("SELECT * FROM task_table WHERE creator_ID is NULL ORDER BY task_ID ASC")