Re: Join tables in MySQL
"jbs_mailuk" <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.newbies |
|---|---|
| Message-ID | <[email protected]> |
David, thank you very much, that's very informative!
Indeed my issue is with Scenario 2, where I have additional
attributes. I still want to do the equivalent of using flattened
relationships (why the prohibition?) without doing extra work - I
would be able to do that in a low-level SQL based system.
If I have a TermCon which has two relationships (equiv to FK) to
Entity1 & Entity2, I want to be able to generate a list (e.g. NSArray)
of related Entity2s to Entity1, something like Entity1.entity2s().
However, there is no such flattened relationship, so it looks like I
have to
a) use Entity1.TermCons() to fill an NSArray and then
b) loop through this to select related TermCon.Entity2() to fill a new
NSMutableArray, checking to ensure uniqueness.
This results in an array of all the Entity2s related to a particular
Entity1.
This is entirely doable but it's all in code, which surely defeats the
advantage of using WO relationships. Hence I thought there must be
some way of explicitly creating a 'Join Table' entity and using the
flattened relationships, hence the desire to create rows in a dual-PK
table, or at least the WO high-level equivalent.
At the DB level, the TermCon table only needs one PK, as the 2
entiities are mapped by 2 FKs, all eo_pk_table friendly.
However, thinking low-level for a moment, why can't I use an explicit
dual-PK table and have WO make sue of flattened relationships, or even
use FK-flattening through a single-PK table?
Is this the way things are, or am I missing something?
John
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/webobjects-newbies/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/