0

So, I have two models: Document and Item. Table creation and insertion works just perfect. What I want to know is that if I do something like this:

mDaoSession.getDocumentDao().deleteInTx(selectedDocuments);
//or
mDaoSession.getDocumentDao().deleteByKeyInTx(documentIds); 

Will any of queries above delete all Items related to this Document or should I do it manually (with additional code)? If not deleting is there any way in GreenDao to accomplish that?

Document.class

public class Document {

    @Id(autoincrement = true)
    private Long documentId;
    @ToMany(referencedJoinProperty = "id")
    public List<Item> items;
}

Item.class

public class Item {

    private Long id;
}
Farid
  • 2,317
  • 1
  • 20
  • 34

0 Answers0