I've got three tables which share a lot of columns, so I thought to use inheritance to map them and make my data layer a bit more OOP, DRY and so on. In all of the three strategies for inheritance mapping mentioned on NHibernate manual (table per class hierarchy, table per subclass and table per concrete class) the superclass (or common interface) is mapped with an Id that is common to all derived subclasses. BUT none of the primary keys columns on my tables are called the same. Any idea how could I map this?
In a diagram:
TAXTYPE_1
- clcpnd -> Differently named Id column
- clcnmb -> Common but differently named column
- clcprc -> Specific column, unique to this table
TAXTYPE_2
- rndind -> Differently named Id column
- rndamb -> Common but differently named column
- rndorc -> Specific column, unique to this table
TAXTYPE_3
- dasfnd -> Differently named Id column
- dastmb -> Common but differently named column
- dascrc -> Specific column, unique to this table
(Yes my columns are named like that. Old system. Can't change it. Kill me now, please)
EDIT: I've made the schema clearer. Also, I want to make my point somewhat clearer: the three tables are of the same type, and I'd like to be able to abstract a supertype implementing the common fields and then write the specifics into each subclass. So I'd have a TaxType class and a TaxType1, TaxType2 and TaxType3 subclasses, and each one of them "is a" TaxType. Also, this would make my other layers easier to use since I'd do queries with a single TaxType repository and so on. Thanks to Jamie Ide for making me realize how badly was the question asked.