• 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
Re: Fetch vs Qualifier on a Relationship Array
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fetch vs Qualifier on a Relationship Array


  • Subject: Re: Fetch vs Qualifier on a Relationship Array
  • From: James Cicenia <email@hidden>
  • Date: Thu, 4 Nov 2004 18:26:24 -0600

Well -

In my early api research apple had my style as the example. So that is my habit.

This code is in my User EO which is in the Session along with the Portfolio so they both
should be in the same context. I had a problem like this about six months ago and it
drove me crazy... then I tried a fetch from the database and it worked then.


I think there is a subtle bug in many-to-many type relationship array queries.

So I don't know really. No matter this works. Just wanted to know if the gurus knew
something I didn't.


-James

On Nov 4, 2004, at 5:58 PM, Chuck Hill wrote:

Faulting should happen automatically. What you are doing works for me. You are sure that the the PortfolioGroup and Portfolio are in the same editing context when doing the in memory filtering.

Chuck

P.S. Stylistically I am compelled so suggest:
EOQualifier portfolioQualifier = EOQualifier.qualifierWithQualifierFormat("porfolio = %@", new NSArray(porfolio));


over
EOQualifier myQualifier2;
NSMutableArray args2 = new NSMutableArray();
args2.addObject("portfolio");
args2.addObject(portfolio);
myQualifier2 = EOQualifier.qualifierWithQualifierFormat("%@ = %@", args2);


Chuck


On Nov 4, 2004, at 2:41 PM, James Cicenia wrote:

Hello -

Why is it when I do a qualifier on a related array I get nothing back but when I do a fetch I get the correct
result?


This works:

EOQualifier myQualifier1;
NSMutableArray args1 = new NSMutableArray();
args1.addObject("user");
args1.addObject(this);
myQualifier1 = EOQualifier.qualifierWithQualifierFormat("%@ = %@", args1);

EOQualifier myQualifier2;
NSMutableArray args2 = new NSMutableArray();
args2.addObject("portfolio");
args2.addObject(portfolio);
myQualifier2 = EOQualifier.qualifierWithQualifierFormat("%@ = %@", args2);

EOAndQualifier andQualifier1 = new EOAndQualifier(new NSArray(new Object[]{myQualifier1,myQualifier2}));

EOFetchSpecification fs = new EOFetchSpecification("PortfolioUserGroup",andQualifier1,null);
NSMutableArray results = (NSMutableArray) this.editingContext().objectsWithFetchSpecification(fs);


While this won't. Why?

Object nameOrdering = null;
EOQualifier myQualifier;
NSMutableArray args = new NSMutableArray();
args.addObject("portfolio");
args.addObject(portfolio);
myQualifier = EOQualifier.qualifierWithQualifierFormat("%@ = %@", args);


NSMutableArray results = (NSMutableArray)EOQualifier.filteredArrayWithQualifier(portfolioUserGr oups(), myQualifier);

the porftfolioUserGroups() is a relation that points portfolios to users to groups. The original array it returns is correct but when
I qualify it with the portfolio it returns nothing. I have checked that the portfolio is correct and the array is correct. I am guessing
it has to do with faulting. Is there some deep fault switch I am missing?


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


This email sent to email@hidden

--
Practical WebObjects - a book for intermediate WebObjects developers who want to increase their overall knowledge of WebObjects, or those who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects





_______________________________________________ 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
References: 
 >Fetch vs Qualifier on a Relationship Array (From: James Cicenia <email@hidden>)
 >Re: Fetch vs Qualifier on a Relationship Array (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Fetch vs Qualifier on a Relationship Array
  • Next by Date: Urgent ! help
  • Previous by thread: Re: Fetch vs Qualifier on a Relationship Array
  • Next by thread: Re: WO & Lucene
  • Index(es):
    • Date
    • Thread