On 11/01/10 12:46 PM, Kevin Menard wrote:
On Sun, Jan 10, 2010 at 8:21 PM, Aristedes Maniatiswrote:
On 11/01/10 12:08 PM, Kevin Menard wrote:

More complicated would be AR's notion of polymorphic relationships, which
guess were added as a way to avoid join tables.
My coincidence Lachlan Deck and I were discussing this just this morning.
We have to think about what is involved, but what about an interface you can
define in CM on which you can then perform a Query? Then rather than forcing
inheritance on users, you could just define an interface.

The common examples (as per the original poster) are attachments, comments
and tags. So you want to be able to define a Taggable interface implemented
by Artists, Paintings, etc. That then ties back to Tags and a special
many-many Taggable_Tags join table with "foreign_key" and "foreign_table"
fields. This implementation looks a lot like vertical inheritance, but
without the inheritance.
So, the problem I've always had with this approach is that renaming a table
invalidates your data. Additionally, you're always doing a join on a
varchar field for which an index may not buy you a whole lot (best case is a
1/n partitioning). The benefit is you don't need n join tables.
There is no reason why the descriminator (class designator) couldn't be a java enum mapped to int or anything else that made the database fast. Even if was text as far as Java was concerned, mysql has the ability to define an enum which makes it smaller/faster. [1] The very same problem exists for vertical and horizontal inheritance.


[1] http://dev.mysql.com/doc/refman/5.0/en/enum.html

Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 7 of 11 | next ›
Discussion Overview
groupdev @
postedJan 10, '10 at 2:06p
activeJan 21, '10 at 9:18a



site design / logo © 2021 Grokbase