Using Business Key in ERD

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:

  1. 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.
    Specify a column as unique

    Specify a column as unique

    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.

    Adding multiple columns as unique index

    Adding multiple columns as unique index

  2. Click on the entity having unique index to drag out the relationship resource icon, and drop it over the target entity.

    Create relationship between entities

    Create relationship between entities

  3. A Relationship Specification dialog will prompt automatically for specifying the FK mapping. Select the unique index in the References field, and press OK.

    Select unique index as reference

    Select unique index as reference

  4. Now you can see the FK which reference to the unique index column was generated.

    Foreign key to unique index column was created

    Foreign key to unique index column was created

When generate database or hibernate, you will see the FK relationship will be based on the business key instead of the primary key.

DDL for database using business key as foreign key

DDL for database using business key as foreign key

Generated hibernate using business key for establish relationships between objects

Generated hibernate using business key for establish relationships between objects

Related Know-how

Related Link

 

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply