• 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: qualifierWithQualifierFormat ???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: qualifierWithQualifierFormat ???


  • Subject: Re: qualifierWithQualifierFormat ???
  • From: David Avendasora <email@hidden>
  • Date: Tue, 4 May 2010 13:54:08 -0400

On May 4, 2010, at 12:34 PM, Theodore Petrosky wrote:

> I copied the fetchJobs(EC, qual, sort) from the _Job.java and pasted into Job.java with the change "fetchSpec.setUsesDistinct(true);".
> Is this the recommended way to handle this?
>
>
> public static NSArray<Job> fetchDistinctJobs(EOEditingContext editingContext, EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings) {
>    EOFetchSpecification fetchSpec = new EOFetchSpecification(_Job.ENTITY_NAME, qualifier, sortOrderings);
>    fetchSpec.setUsesDistinct(true);
>    fetchSpec.setIsDeep(true);
>    NSArray<Job> eoObjects = (NSArray<Job>)editingContext.objectsWithFetchSpecification(fetchSpec);
>    return eoObjects;
>  }

That is the best way to handle this situation if you need the DB to handle the distinct, but you may get acceptable performance by simply using:

public static NSArray<Job> fetchDistinctJobs(EOEditingContext editingContext, EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings) {
    return ERXArrayUtilities.arrayWithoutDuplicates(fetchJobs(editingContext, qualifier, sortOrderings));
 }

It's less duplicated code, but it won't be as fast either. But if the array isn't that big it might not make much difference.

Dave _______________________________________________
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: 
 >Re: qualifierWithQualifierFormat ??? (From: Theodore Petrosky <email@hidden>)

  • Prev by Date: Re: qualifierWithQualifierFormat ???
  • Next by Date: Re: back to ERXBatchingDisplayGroup instead of ERXDisplayGroup
  • Previous by thread: Re: qualifierWithQualifierFormat ???
  • Next by thread: Re: qualifierWithQualifierFormat ???
  • Index(es):
    • Date
    • Thread