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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:56:57+00:00 2026-06-02T20:56:57+00:00

I have a Entity with a column of type ID named responsibleUsers. In this

  • 0

I have a Entity with a column of type ID named “responsibleUsers”. In this column I store an Array containing NSNumbers.
I want to fetch all objects of this entity, that match my current User. Therefore i create following predicate:

    [NSPredicate predicateWithFormat: @"%@ IN responsibleUsers",[NSNumber numberWithInteger: curUser.oID.integerValue] ]

whatever I try, my App crashes. Once with a EXC_BAD_ACESS, once with “unimplemented SQL generation for predicate nsnumber”

What is the correct way to query my entity?

  • 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-02T20:56:59+00:00Added an answer on June 2, 2026 at 8:56 pm

    The query you are trying assumes that you have two entities: the entity you querying (let’s call it Group) and another one, perhaps called User, which is set up as a to-many relationship from Group called responsibleUsers. You would then be able to use the predicate you suggest:

    [NSPredicate predicateWithFormat:@"%@ IN responsibleUsers, aUser]; 
    

    This would be the recommended use of Core Data object graphs.

    In your setup, it seems you have an array of NSNumber set as a property rather than a relationship. Therefore you cannot use such a query. You simply have to retrieve the array and query the array.

    BOOL containsResponsibleUser = NO;
    for (NSNumber *n in aGroup.responsibleUsers) {
        if ([n isEqualTo:[NSNumber numberWithInteger: curUser.oID.integerValue]]) 
           containsResponsibleUser = YES;
    }
    

    If you are indeed querying something like a group of users, I would recommend the first approach. If you are querying some kind of user, I would suggest a BOOL property responsible as the most efficient solution.

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

Sidebar

Related Questions

I have some form, and one column have Entity type, but this entity have
I have an entity named 'account' which will have a username column and I
I have an entity product: @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = product)
I have an XML hierarchy like this in an XML type column of a
I have a DateTime type column named CreatedDate in my sql table, and am
I have an entity ,there is a array type attribute:productKey.I try to add a
I have an entity class that has a property with an underlying db column
I have an abstract entity called Block which contains two attributes: column and order
I have the following entities: @Entity public class Owner{ @Id @Column(name = OWNER_ID) @OneToMany()
I have an old database (with terribly named tables and columns) and an entity

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.