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 7402105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:39:26+00:00 2026-05-29T04:39:26+00:00

Is it possible for a managed object to have a relationship with ‘optional’ unchecked?

  • 0

Is it possible for a managed object to have a relationship with ‘optional’ unchecked?

If so, how can I insert it without having validateForInsert: fail?
I want the relationship to be mandatory but I am unable to establish a connection between the current and another object before inserting it because the two objects I want to connect are in different contexts.

Concrete Example:
I generally have one MOC. Let’s say I have a Person saved in the context.
Now I want to create a new one, so I instantiate a Person but do not insert it into the context yet. When the user picks a brother from some table view and I set the ‘brother’ property, the inverse relationship would attempt to establish a connection between the object saved in the MOC and the one that does not exist in the MOC yet, which would cause the app to crash.
My Question: if the ‘brother’ relationship would not be optional, could I even create and insert a new person?

  • 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-29T04:39:29+00:00Added an answer on May 29, 2026 at 4:39 am

    What a dumb question of myself.

    Of course you can insert an object into the context without causing an error. You can then set up the (mandatory) relationships.
    The validation of relationships and properties only occurs when actually trying to save the context.

    In my app however, I did not insert the entity until the ‘NewItemVC’ finished. I called -validateForInsert: on the object being created to check if it’s valid an enable/disable the done button.
    Since I cannot establish the mandatory relationship without inserting it, this is not a good idea, I gotta think of something new.

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

Sidebar

Related Questions

Is it possible to perform a global reversed-find on NHibernate-managed objects? Specifically, I have
Is it possible to inject an instance of logger class object using Managed Extensibility
Is it possible to define a spring-managed EJB3 hibernate listener? I have this definition
What is the easiest way to do this? Is it possible with managed code?
Is it possible to call managed code, specifically IronRuby or IronPython from unamanaged code
Possible Duplicate: Choosing between MEF and MAF (System.AddIn) Is the Managed Extensibility Framework a
Is it possible to enumerate all managed threads in C#? Visual Studio seems to
Here's something I know is probably possible but I've never managed to do In
Is it possible to set a tab control style like TSC_BUTTONS on a managed
Is it possible to create a SQL DB from a Linq2Sql model? I managed

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.