user689081
user689081

Reputation: 131

How do I fetch an object that is not part of an relationship

Lets say we have two entities Department and Employees with a one-to-many relationship.

How do I fetch all employees who are not part of a selected Department?

Upvotes: 1

Views: 37

Answers (1)

Caleb
Caleb

Reputation: 124997

Create a fetch request for the Employee entity and add a predicate that says "self.department NOT like %@", passing in the selected department as the parameter.

Upvotes: 2

Related Questions