Skip Headers

# Table Sequencing

Previous

Next

With table sequencing, you create a single database table that includes sequencing information for one or more sequenced objects in the project. TopLink maintains this table to track sequence numbers for these object types.

As Figure: TopLink Table Sequence Table shows, the table may contain sequencing information for more than one class that uses sequencing. The default table is called `SEQUENCE` and contains two columns:

- `SEQ_NAME`, which specifies the class type to which the selected row refers

- `SEQ_COUNT`, which specifies the highest sequence number currently allocated for the object represented in the selected row

TopLink Table Sequence Table

Description of "TopLink Table Sequence Table"

The rows of the `SEQUENCE` table represent each sequence object: one for each class that participates in sequencing or a single sequence object across several classes so that they can benefit from the same preallocation pool. When you configure sequencing at the descriptor level (see "Configuring Sequencing at the Descriptor Level"), you specify the `SEQ_NAME` for the class. Add a row with that name to the `SEQUENCE` table and initialize the `SEQ_COUNT` column to the value `0`.

Each time a new instance of a class is created, TopLink obtains the required sequence value. For efficiency, TopLink uses preallocation to reduce the number of table accesses required to obtain sequence values (see "Sequencing and Preallocation Size").

You can create the `SEQUENCE` table on the database in one of two ways:

- Use TopLink Workbench to create the table. See "Generating Tables on the Database" for more information.

- Use the TopLink table creator to create and update the table manually. See "Generating SQL Creation Scripts" for more information.

You can configure table sequencing using TopLink Workbench or Java. Oracle recommends that you use TopLink Workbench. For more information about configuring table sequencing, see "Configuring Sequencing at the Project Level" or "Configuring Sequencing at the Session Level".