Home

 

Adding inheritance

We have two types of transactions, credit and debit, specified in the database table by the TRANS_TYPE column, which became the transType field in the Transaction class. In this section we define two subclasses of Transaction, Credit and Debit. We use single table inheritance, that is, we map all three classes to one table. The TRANS_TYPE column becomes the discriminator column, and the transType field is deleted in the Transaction class.

ibm.com/redbooks