Dali Java Persistence Tools User Guide Release 3.2 Release 3.2 |
|
Managing the orm.xml file |
Specifying entity inheritance |
Home > User Guide > Tasks > Specifying additional tables
Add a secondary table annotation to an entity if its data is split across more than one table.
To add a secondary table to the entity,
Select the entity in the Project Explorer.
In the JPA Details view, select the Secondary Tables information.
Click Add to associate an additional table with the entity. The Edit Secondary Table dialog appears
Select the Name, Catalog, and Schema of the additional table to associate with the entity.
Eclipse adds the following annotations the entity:
@SecondaryTable(name="NAME", catalog = "CATALOG", schema = "SCHEMA")
To override the default primary key:
Enable the Overwrite default option, then click Add to specify a new primary key join column. The Create New Primary Key Join Column appears.
Select the Name, Referenced column name, Table, and Column definition of the primary key for the entity.
Eclipse adds the following annotations the entity:
@SecondaryTable(name="NAME", catalog = "CATALOG", schema = "SCHEMA", pkJoinColumns = {@PrimaryKeyJoinColumn(name="id", referencedColumnName = "id"),@PrimaryKeyJoinColumn(name="NAME", referencedColumnName = "REFERENCED COLUMN NAME", columnDefinition = "COLUMN DEFINITION")})
Related reference
Related concepts