From: Nick <ni...@dd...> - 2003-04-29 16:36:59
|
On Tue, 2003-04-29 at 03:23, Ian Bicking wrote: > On Mon, 2003-04-28 at 14:49, Nick wrote: > > I was wondering, when instantiating a Join object, shouldn't joinColumn > > default to idName of the class instead of always making up the id column > > with the Style? > > Say you have a Person and an Address (one to many), Address has a > person_id column, but Person has an id column, and they go together. > How does idName come into it? Most non-MySQL schema designers (in my experience, anyway) tend to name columns that are the same data the same in every table they appear in. That means, if person_id is in Address, then the key in Person is person_id as well. This uncomplicates JOINS in a major way, as well as maintains consistency in your data dictionary. Therefore, idName for a table is almost always the same name as the foreign key in another table, except where you have 2 in the same table. > I mean, ideally when you define the foreign key column in Address it > would automatically create the join, but the fear of circular > dependencies has scared me off from doing that so far :) Actually, I did do it that way, and you're not going to get any circular dependencies as long as you're using strings to resolve your class names late. Perhaps you could explain some of your fears to me, because I still don't fully grok every aspect of the code yet :) I was originally using class references for my foreign key definitions and ran into the circular dependecy probelms, but there were ways around that, too. The programmer *could* get into an infinite loop of they follow circular references, but that's their problem :-P That can happen now. Nick |