Table of Contents
We will explore mapping Java inheritance structures to the database.
Our use case is about mice. There is a parent class Mouse and two sub classes LibraryMouse, KitchenMouse. As the name indicates one lives in a library and the other one in the kitchen.
Hibernate allows to map inheritance structures to database table and it provides a number of approaches to do this. Not all approaches are support by XML mappings and not all by annotations. Source code for the samples can be found in the package de.laliluna.inheritance in the project mapping-examples-xml and mapping-examples-annotation.