using named fetch specifications
using named fetch specifications
- Subject: using named fetch specifications
- From: William Norris <email@hidden>
- Date: Sun, 8 Aug 2004 18:27:26 -0500
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.queryBindings());
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.