Skip Headers

# Unary Table Sequencing

Previous

Next

Although similar to table sequencing (see "Table Sequencing"), with unary table sequencing, you create a separate sequence table for each sequenced object in the project.

As Figure: TopLink Unary Table Sequence Table shows, sequencing information appears in the table for a single class that uses sequencing. You can name the table anything you want but it must contain only one column named (by default) `SEQUENCE`.

TopLink Unary Table Sequence Table

Description of "TopLink Unary Table Sequence Table"

When you configure sequencing at the descriptor level, you specify the sequence name for the class: this is the name of the unary table sequence table. Figure: TopLink Unary Table Sequence Table shows a unary table sequence for the `Employee` class. The `Employee` class descriptor is configured (see "Configuring Sequencing at the Descriptor Level") with a sequence name of `EMP_SEQ` to match the unary table sequence table name. TopLink adds a row to this table and initializes the `SEQUENCE` column to the value `1`.

Each time a new class is created, TopLink obtains the required sequence value from the single row of the unary sequence table corresponding to the class. 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 unary table 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.

If you are migrating a BEA WebLogic CMP application to OC4J and TopLink persistence (see "Migrating BEA WebLogic Persistence to OC4J TopLink Persistence"), the TopLink migration tool does not migrate BEA WebLogic single column sequence tables to TopLink unary sequence tables (see "Unary Table Sequencing"). After migration, you must manually configure your project to use TopLink unary sequence tables if your application originally used single column sequence tables in BEA WebLogic.

Currently, you can only configure unary table sequencing in Java using the `UnaryTableSequence` class (for more information, see "Using Java").