If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Representing interfaces

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-04-06, 00:54
vk101 vk101 is offline
Registered User
 
Join Date: Mar 2006
Posts: 43
Representing interfaces

If you have an interface, such as Notifiable, and you want to represent that in your database, how would you do it? Assume you have 10 entities that should be Notifiable, but each are in their separate inheritance hierarchies.

How would you let each one of those 10 entities represent their association to a Notifiable entity that has its own characteristics and relationships?

Seems like a very interesting problem to me, but I can't think of any good (normalized, strong foreign keys) solution.
Reply With Quote
  #2 (permalink)  
Old 08-04-06, 07:23
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
what is an interface?

there is only one way to represent things in a database, and that's with a table

does having an interface table (whatever that is) with its own PK solve what you're trying to do? each of the 10 entities (other tables) would then have a FK to the interface table
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 08-04-06, 10:09
vk101 vk101 is offline
Registered User
 
Join Date: Mar 2006
Posts: 43
An interface (Java) can be thought of as a superclass for the purposes of this discussion:

A Car inherits from Vehicle only, but can also implement the interfaces Drivable, Turnable, Parkable, each of which can have its own properties.

I'm essentially talking about multiple inheritance.

Yes, what you suggest solves most of the problem, but (I should've combined it with my other question on discriminators) wouldn't each interface (i.e. superentity) table need discriminators for each of the 10 entities?

And that'd create problems when adding a new entity that implements the interface.

And there's the fact that multiple inheritance in data modeling is apparently an 'illegal' construct...

So confused...
Reply With Quote
  #4 (permalink)  
Old 08-04-06, 11:33
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
sorry, i don't do superclass inheritable multi-property java interface discriminators
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On