In database design, instead of using primary key we may also use various business keys (also known as alternate key) to unique identify records. The use of business key give you different perspective on identify records from your database tables. In Visual Paradigm you can use these business key to establish relationships with other entities. In this article we will show you how to make use of the business key to relating entities.
To use business key in ERD:
- Define unique index to the column(s) which wish to use as business key. For single column you can right click it and select unique form the popup menu.
For multiple columns you can right click on the entity, and select Open Specification > Indices > Add, then specify the index as Unique and choose the columns you wish to include in the index.
- Click on the entity having unique index to drag out the relationship resource icon, and drop it over the target entity.
- A Relationship Specification dialog will prompt automatically for specifying the FK mapping. Select the unique index in the References field, and press OK.
- Now you can see the FK which reference to the unique index column was generated.
When generate database or hibernate, you will see the FK relationship will be based on the business key instead of the primary key.