Hello WO Gurus, 

I need a good example of how to search my EOModeled database using relationships.  Both of the books I have purchased have remarkably little to say on the subject.  Here are the entities and their relevant attributes. . . 

Company
(PK) company_id
Relationship: Sellers (to Many)

Seller
(PK) seller_id
(FK) seller_company_id
seller_code
Relationship: Company (to One)

My code successfully gets a Company object from the database (referred to as import_Company below). It also retrieves a String called source_code to compare with the Seller object's seller_code to help narrow the search.  

What I want is essentially an object from Seller where (seller_company_id == import_Company.company_id) and (seller_code == source_code)

I have looked high and low for an example of the "WebObjects Way" to do this.  Most all of the specific EOQualifier and FetchSpec examples are about following a relationship to some value employee.department.name etc.  I was good and did NOT include Primary or Foreign Keys accessors in my Java Class files.

I could do NSArray SellerArray = (NSArray)import_Company.Sellers();  and then search each array element for the source_code == seller_code match I'm looking for, but there must be a better way.  I have tried to adapt some of the examples I managed to find, but naming conventions were not good enough to help me figure out if they were passing relationships or something else.  I have tried filteredArrayWithQualifier and objectMatchingValues with no success.  

Thanks for bailing out the newbie, 

Scott
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to