| Hi, Jim, On Feb 26, 2006, at 3:21 AM, Jim Wong wrote: thanks art. A flattened relationship is a relationship whose definition in the EOModel is based on the definition of another relationship in such a way that you don't have to use the base relationship in your code. So, for your problem you have three entities in the following structure: COMPANY <->> OPPORTUNITY_COMPANY <<-> OPPORTUNITY This structure, however, is an artifact of relational databases and is the solution that they force on you when what you really want is this structure: COMPANY <<->> OPPORTUNITY Even though this latter structure is perfectly acceptable in your object graph where a Company instance would have an NSArray attribute named opportunities whose elements each point to a related opportunity and where an Opportunity instance would have an NSArray attribute named companies whose elements each point to a related company, it simply can't be reflected in the relational database and still have the database be relational. Notice that in the object graph, then, there is no direct correspondence to the OPPORTUNITY_COMPANY table. So, EOModel lets you create a pseudo-relationship in each of COMPANY and OPPORTUNITY to represent the NSArrays that will be derived, and each of these pseudo-relationships is defined on the underlying real relationship (real in the sense that it's directly reflected in the relational model). Finally, the diamond in EOModeler that determines whether an EOEntity's attribute or relationship is reflected in the object graph as a class property is removed so that the "real" relationships are not reflected anywhere in the object graph, but are replaced by the "pseudo-relationships". This replacement in the EOModel and, as a consequence, in the class model of the "real" relationships by the "pseudo-relationships" is called flattening the relationships. From the EOModeler User Guide: A flattened attribute is a special kind of attribute that you effectively add from one entity to another by traversing a relationship. When you form a to-one relationship between two entities (such as Person and PersonPhoto), you can add attributes from the destination table to the source table. Regarding their downsides and when they should be used, take a look at the EOModeler User Guide under flattened relationships and flattened attributes. You can find the guide at: Regards, Jerry
-- __ Jerry W. Walker, WebObjects Developer/Instructor for High Performance Industrial Strength Internet Enabled Systems jerrywwalker@gee-em-aye-eye-ell.com 203 278-4085 office |
_______________________________________________ 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]
