In relational database, records are identified by a unique value. We call this value the primary key. Some databases allow to control how this unique value is being generated by defining the sequence. In this article, we will show you how to model the sequence with Visual Paradigm and use as the ID Generator for your database tables.
- Click on the Sequence tool in the diagram palette and drop it on your diagram.
- Name it with a meaningful name.
- Now we can define the details of the sequence. Right click on it to open the specification dialog.
- Fill in the details of your sequence, such as Start With, Increment By, Min Value, Max Value, etc.
- Click OK to commit.
Using the Sequence
Once you get the sequence defined, you can then use it as the ID Generator for your entities. To use the sequence:
- Right click on the primary key column in your entity and select Open Specification
- Select sequence in the ID Generator combo box.
- Select the sequence you defined in the Key field.
After that, when generate hibernate from this model, this table will automatically use the sequence you have defined to generate the primary key values.
|You can watch this tutorial in action on Visual Paradigm Online Training Center and YouTube.How to Use Sequence as ID Generator for Primary Key in ERD on VP Training CenterHow to Use Sequence as ID Generator for Primary Key in ERD on YouTube.|