How does greenDao @toMany relation deletion procedure work?

205 views Asked by At

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;
}
0

There are 0 answers