• 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: using named fetch specifications
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using named fetch specifications


  • Subject: Re: using named fetch specifications
  • From: David Elsner <email@hidden>
  • Date: Mon, 9 Aug 2004 09:54:46 +1000

I do mine like this when I have a fetch spec in the model:

  bindings = new NSMutableDictionary();
  bindings.setObjectForKey(someCourse,"courseNumber");
  bindings.setObjectForKey(someCourseDeptment,"courseDept");
  NSMutableArray searchResults =
(NSMutableArray)EOUtilities.objectsWithFetchSpecificationAndBindings(ec,
"Course","Search",bindings);


Cheers
Dave



On 09/08/2004, at 9:27 AM, William Norris wrote:

> I've gotten my named fetch spec to work correctly, but it just feels
> like I've got too much java code... from reading the apple docs, it
> would seem that binding a named fetch spec to input boxes like this
> would automate most of it and prevent me from having to write so much
> code.  see what you think...
>
> I have an entity named "Course" that represents a college course, with
> properties "dept" and "number".  I've made a named fetch specification
> "Search" to use the qualifier "((dept = $courseDept) and (number =
> $courseNumber))".  A display group "courseDisplayGroup" was then
> created in my WOComponent, and the two queryBindings connected with
> two input boxes.  my action "findCourse" contains the following code:
>
> EOModelGroup modelGroup = EOModelGroup.defaultGroup();
> EOFetchSpecification fs = modelGroup.fetchSpecificationNamed("Search",
> "Course");
> fs =
> fs.fetchSpecificationWithQualifierBindings(courseDisplayGroup.queryBind
> ings());
> NSMutableArray searchResults = new
> NSMutableArray(editingContext.objectsWithFetchSpecification(fs));
> course = (Course)searchResults.objectAtIndex(0);
>
>
> like I said, it does work which I am happy about, but it just feels
> like too much code for such a simple thing.  I feel like i'm making
> three lefts turns in order to turn right.
>
> thanks,
> will
> _______________________________________________
> webobjects-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/webobjects-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: using named fetch specifications
      • From: William Norris <email@hidden>
References: 
 >using named fetch specifications (From: William Norris <email@hidden>)

  • Prev by Date: Re: Xcode 1.5 & Documentation
  • Next by Date: Re: using named fetch specifications
  • Previous by thread: using named fetch specifications
  • Next by thread: Re: using named fetch specifications
  • Index(es):
    • Date
    • Thread