Room delete multiple rows by WHERE IN clause not working
You need to pass an array or list when you are dealing with WHERE IN
clause. Like:
@Dao
interface ItemDao {
@Query("DELETE FROM Item WHERE id IN (:ids)")
fun deleteItemByIds(ids: Array<Long>)
}
I know the question asks for deleting the rows with a list of Ids but my app crashes when I'm passing 10k+ Ids. So instead I tried passing the object itself and it worked for me.
@Dao
interface ItemDao {
@Delete
fun deleteUserByList(userList: Array<User>)
}
This way I'm able to delete more than 10k rows.
In case anyone needs it.