Cascade delete based on @ForeignKey in Android Rooms ORM
Cascade delete based on @ForeignKey in Android Rooms ORM I have two entities DBList adnd DBListContent . With one to many relationship between DBList and DBListContent . DBList DBListContent DBList DBListContent Here is the DBList class DBList @Entity(tableName = "lists") public class DBList { @PrimaryKey private String listId; private String title; private String createdDateTime; } Here is the DBListContent DBListContent @Entity(tableName = "listContents") public class DBListContent { @PrimaryKey public String listContentId; public String content; public String lastEditedBy; public String lastEditedDateTime; @ForeignKey(entity = DBList.class, parentColumns = "listId", childColumns = "dbListId", onDelete = CASCADE) public String dbListId; } When I delete a row in lists table, the corresponding rows in the listContents table are not deleted. lists listContents I deleted the rows using the following ...