• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Finding an empty to many relationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Finding an empty to many relationship


  • Subject: Finding an empty to many relationship
  • From: Fabrice Pipart <email@hidden>
  • Date: Mon, 17 Mar 2008 15:15:43 +0100

Hi !

I am sure this question has already been asked. But I looked in the mailing list archives, in wiki books and in project wonder and could not find any solution to a problem that should be... simple.
I have two entities Source and Dest with an optional many to many relationship between them.
I want to fetch all the Source EOs that have no Dest EO in the many to many relationship.

At first I tried :

String format = "(dests = nil)";
EOQualifier qual = EOQualifier.qualifierWithQualifierFormat(format, new NSArray(new Object[] { }));
EOFetchSpecification fs = new EOFetchSpecification("Source", qual, null);

No luck.
And the funniest part is that if you fetch with 
String format = "NOT (dests = nil)";
and if among 10 objects you have 6 that correspond, you still have 0 using "(dests = nil)"

I think I understand why but the behavior is suprising.

ERXToManyQualifier should be a solution looking at its Javadoc.
I tried the following :

NSArray<Dest> a;
ERXToManyQualifier qual = new ERXToManyQualifier("dests", a);
EOFetchSpecification fs = new EOFetchSpecification("Source", qual, null);

I get a null pointer exception because a is null.
I tried 
NSArray<Dest> a = NSArray.emptyArray;

Still no luck, I get a SQL error because there is no element in the Array.


Is it THAT complicated to fetch an EO with an empty to-many relationship ???



Best regards

Fabrice Pipart

www.easyshadow.com
EasyMediaOnline
Digital Signage Software

Easyshadow
Palais de la Scala
1 avenue Henri Dunant
Suite 1155
MC - 98000 Monaco

Skype: fabrice.pipart
Tel.  +377 97 98 21 04 (direct)
Fax. +377 97 70 88 07


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Finding an empty to many relationship
      • From: Chuck Hill <email@hidden>
  • Prev by Date: Re: Most efficient way to iterate through an NSArray
  • Next by Date: Updated EOF Diagram
  • Previous by thread: Re: Most efficient way to iterate through an NSArray
  • Next by thread: Re: Finding an empty to many relationship
  • Index(es):
    • Date
    • Thread