TomTaila TomTaila - 2 years ago 283
Java Question

How can I recursively delete records using (Java/Android)?

How can I recursively delete records with one-to-many relationships using

For example I have the following nested objects:

public class RealmUnit extends RealmObject {
private int id;
private RealmList<RealmChapter> chapters;
public RealmUnit() {
chapters = new RealmList<>();

public class RealmChapter extends RealmObject {
private int id;
private RealmList<RealmChapterGoal> chapterGoals;
public RealmChapter() {
chapterGoals = new RealmList<>();

public class RealmChapterGoal extends RealmObject {
private String type;
private String text;
public RealmChapterGoal() {}

Answer Source

Currently Realm doesn't cascading deletes, but it is on our TODO and is tracked here:

So right now your only option is unfortunately a manually bottom-up approach.

for(RealmChapter chapter: realmUnit.getChapters) {


There is also a few more work-arounds described here:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download