Skip Headers

# Configuring a Sequence by Name

Previous

Next

As Example: Associating a Sequence with a Descriptor shows, you associate a sequence with a descriptor by sequence name. The sequence `EMP_SEQ` was added to the login for this project in Example: Example Sequences. When a new instance of the `Employee` class is created, the TopLink runtime will use the sequence named `EMP_SEQ` (in this example, a `TableSequence`) to obtain a value for the `EMP_ID` field.

Associating a Sequence with a Descriptor

    empDescriptor.setSequenceNumberFieldName("EMP_ID"); // primary key field
    empDescriptor.setSequenceNumberName("EMP_SEQ");