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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:54:26+00:00 2026-06-05T07:54:26+00:00

I have a problem sorting join entities with CoreData. I’ve made a model like

  • 0

I have a problem sorting “join” entities with CoreData.
I’ve made a model like this:
enter image description here

The logic is like this: Entity A has a list of items. User can selects one or more items from A and put them in entity C. That works fine. But the results set becomes unsorted (logically). So I’ve implemented a “join” entity B like this:

enter image description here

So now the results can be sorted by the field date in entity B which is kind a “join” between entity A and B.

But here I get confused. When I insert new items into B, do I need to add them also to the C and A or they are inserted automatically with relations?

EDIT – solution:
enter image description here

  • 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-06-05T07:54:30+00:00Added an answer on June 5, 2026 at 7:54 am

    When you call one of the CoreData-generated addXXXItemsObject methods, or set a relation property like b.c = myCInstance;, that will set up exactly one relation for you.

    So you can set up your B object in a number of different ways. First set up the c <--> b relation:

    b.c = instanceOfC;
    // or
    [c addBItemsObject:b];
    

    And then the b <--> a relation:

    b.a = instanceOfA;
    // or
    [a addBItemsObject:b];
    

    The simplest is probably just to use the first version for each:

        b.c = instanceOfC;
        b.a = instanceOfA;
    

    Also, looking at your screenshot, it looks like you need to make some ends of your relationships as to-many.

    EDIT: edited this about 5 times to make it more coherant.

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

Sidebar

Related Questions

I have a problem when sorting a generic list in C# I have a
I have a little problem with sorting out a list using an implementation of
I have this Problem and solving it is not the problem, more like what
I have a problem sorting vectors in 2D vector? I would like to sort
I have problem sorting my Gridview using my custom entity classes My complex entity
I have a problem with how the List Sort method deals with sorting. Given
I have a problem with sorting NSTableColumn contents. In my NSTableView there are three
I have a problem with sorting items in table in PHP. Here is what
I have a complex sorting problem with my SQL statement. I have a table
I have a problem on using LinqToSQL with paging + dynamic sorting. These are

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.