Ignacio Giagante
Ignacio Giagante

Reputation: 434

Avoid deleting children objects - Realm

I have the following scenario:

One Dose has one or more Nutrients and when the dose is deleted I would like that the nutrients stay in database. Is there any annotation that allows to do that?

Thank in advance!

Upvotes: 0

Views: 46

Answers (1)

EpicPandaForce
EpicPandaForce

Reputation: 81539

If you delete a Dose object, only the links get invalidated, but the Nutrient classes that belong to it stay in the database when you call dose.deleteFromRealm().

So basically that's actually the default use-case.

Upvotes: 2

Related Questions