Skip to main content
1 of 2
Jordão
  • 651
  • 6
  • 7

I see these advantages of using a type in the base table:

  • You'll know exactly which other tables to read.
  • You'll know directly which concrete class to instantiate when hydrating.
  • You know what type of data you have just by looking at the parent table row.

And this disadvantage:

  • If you retrieve the instance via the application, you'll have to issue two queries: one to retrieve the base table data, and another to retrieve the children data given the found type. (This can be alleviated by using a stored procedure that encapsulates that logic.)

On the other hand, I don't think that multiple joins should be a problem, but remember that they need to be outer joins if you're not using a discriminator type in the parent table. You simply don't know what type of data you're looking at. But, as usual, profile accordingly.

Jordão
  • 651
  • 6
  • 7