CHAPTER 5 Inheritance and custom types …
…
… … The element groups some properties and tells Hibernate to get them from a secondary table. This mapping element has many uses, and you ll see it again later in the book. In this example, it separates the CreditCardproperties from the table per hierarchy into the CREDIT_CARD table. The CREDIT_CARD_ID column of this table is at the same time the primary key, and it has a foreign key constraint referencing the BILLING_DETAILS_ID of the hierarchy table. The BankAccount subclass is mapped to the hierarchy table. Look at the schema in figure 5.4. At runtime, Hibernate executes an outer join to fetch BillingDetails and all subclass instances polymorphically: select BILLING_DETAILS_ID, BILLING_DETAILS_TYPE, OWNER, CC.CC_NUMBER, CC.CC_EXP_MONTH, CC.CC_EXP_YEAR, BA_ACCOUNT, BA_BANKNAME, BA_SWIFT from BILLING_DETAILS left outer join CREDIT_CARD CC on BILLING_DETAILS_ID = CC.CREDIT_CARD_ID
In case you need quality webspace to host and run your web applications, try our personal web hosting services.