At 12:08 PM 7/27/2006, Martin J. Laubach wrote:
>| If you have a link table defined, and the foreign key constraints
>| set up appropriately, and it's all unambiguous (e.g. you don't have
>| two different relationships from this table using the same link table)
>| then Glorp will probably manage to figure out that it ought to use a
>| link table, and what the join ought to be, automatically.
>
> Indeed it does (did I mention that Glorp is pretty amazing?). That's
>why I'm wondering what the useLinkTable is about.
>
> I can see that one might to use join: ... to define exactly how
>to get at the information, but what is useLinkTable for?
Well, it tells Glorp whether or not there's a link table in use, which makes it do a number of things differently. For one thing, we always want to cascade delete of link table rows. Obviously we construct the query differently. Internally there's some interesting stuff to do with what object owns a row and RowMapKeys, but if you don't have to worry about that you probably don't want to :-)
And it looks to me like it won't figure out whether or not there's a link table automatically. If it knows whether or not you're using a link table, it will get the join, but it has to be told if there's a link table or else it will just assume that the link table is the target, and get confused.
--
Alan Knight [|], Cincom Smalltalk Development
knight@...
aknight@...
http://www.cincom.com/smalltalk
"The Static Typing Philosophy: Make it fast. Make it right. Make it run." - Niall Ross
|