Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7411901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:27:28+00:00 2026-05-29T06:27:28+00:00

How do I handle the deletion of the following objects? What should my delete

  • 0

How do I handle the deletion of the following objects? What should my delete rules look like?

Here’s what my object graph looks like:

Boss

  • Boss-Department has a many-to-many-relationship
  • If a Boss is deleted,
    the Departments belonging to that Boss should NOT be deleted (but the
    Departments’ relationship to this Boss should be deleted)

Department

  • Department-Employee has a many-to-many relationship
  • Department-Boss has a many-to-many relationship
  • If a Department
    is deleted, the Employees belonging to that Department should be
    deleted IF they don’t have a relationship to any other Department

Employee

  • Employee-Department has a many-to-many relationship
  • Employees will never be deleted directly (only through the deletion of a department). Oh happy life!
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:27:29+00:00Added an answer on May 29, 2026 at 6:27 am

    In this situation the Delete rules for your objects should be handled like this

    Boss-Department -> Nullify

    Department-Employee -> Deny

    Department-Boss -> Nullify

    Here is what Apple explains the Delete Rules as

    Deny: If there is at least one object at the relationship destination,
    then the source object cannot be deleted. For example, if you want to
    remove a department, you must ensure that all the employees in that
    department are first transferred elsewhere (or fired!) otherwise the
    department cannot be deleted.

    Nullify: Set the inverse relationship for
    objects at the destination to null. For example, if you delete a
    department, set the department for all the current members to null.
    This only makes sense if the department relationship for an employee
    is optional, or if you ensure that you set a new department for each
    of the employees before the next save operation.

    Cascade: Delete the
    objects at the destination of the relationship. For example, if you
    delete a department, fire all the employees in that department at the
    same time.

    No Action: Do nothing to the object at the destination of
    the relationship. For example, if you delete a department, leave all
    the employees as they are, even if they still believe they belong to
    that department.

    For more information check out the CoreData Programming Guide

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to handle a return result from an AsyncTask outside of the
I'm trying to handle a JSONP Callback, I have the following JavaScript var URL
I am developing an application in which I must handle some lists (insertion, deletion).
Hello I am looking for an event I can handle for row deletion.
I have following problem. I have typical master/detail UI scenario. I set main object
This may be a subjective question leading to deletion but I would really like
I have a program doing something like the following: class SomeObject{} { void function(int
I have a Python script which looks for any changes in a folder(addition/deletion) of
I'd like to handle entries for reporting purposes even if the entries are deleted.
To Handle the error in my web application I am Creating a log file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.