How to Define Sequence for your ID Generator in ERD

coverIn 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.

 

Defining Sequence

  1. Click on the Sequence tool in the diagram palette and drop it on your diagram.

    Create sequence in ERD

    Create sequence in ERD

  2. Name it with a meaningful name.

    Rename the sequence

    Rename the sequence

  3. Now we can define the details of the sequence. Right click on it to open the specification dialog.

    Open specification dialog of the sequence

    Open specification dialog of the sequence

  4. Fill in the details of your sequence, such as Start With, Increment By, Min Value, Max Value, etc.

    Define details of the sequence

    Define details of the sequence

  5. 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:

  1. Right click on the primary key column in your entity and select Open Specification

    Open the specification dialog of the primary key column

    Open the specification dialog of the primary key column

  2. Select sequence in the ID Generator combo box.

    Select sequence as ID Generator

    Select sequence as ID Generator

  3. Select the sequence you defined in the Key field.

    Select the sequence which just created

    Select the sequence which just created

After that, when generate hibernate from this model, this table will automatically use the sequence you have defined to generate the primary key values.

Video

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.

Related Articles

Related Links

 

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply