
Chapter 4 Generating Hibernate Persistent Objects and JSF Pages
Table per class hierarchy
Using a table per class hierarchy means that all attributes of subclasses are migrated to the parent class.
The following diagram shows inheritance mapping:
The following diagram shows the parent table:
To define a table per class hierarchy:
- Open the property sheet of the root class, click the Details tab, and select "Generate table".
- Add an attribute that will be used as a discriminator column.
- Click the Hibernate tab and specify the discriminator column name, value, and type.
- Open the property sheet of a subclass, click the Details tab, and select "Migrate column".
- Click the Hibernate tab and specify a discriminator value (which should be unique for each subclass).
- Generate a PDM with O/R mapping.
- Verify the mapping file in the Preview tab of the root class property sheet.
Copyright (C) 2005. Sybase Inc. All rights reserved.
|
|