Using Sequence Numbers with Entity Beans

When implementing sequencing for Entity Beans, you must provide create() methods and the corresponding ejbCreate() and ejbPostCreate() methods for your bean home and bean class.

TopLink creates the primary key value when you first insert the bean in the database. The key value is not passed as a parameter to the create() methods because they do not set the primary key value (the key is generated).


Note: Be careful when using transactions with these create methods. If you create an Entity Bean within a transaction and you use native sequencing in Sybase, SQL Server or Informix, then the bean's key is not initialized until the transaction commits and the bean is persisted to the database for the first time.

Related Topics

About TopLink Descriptors

Working with Descriptors
Setting Descriptor Information
Working with Sequencing
Using Native Sequencing
Using Sequence Tables
Preallocating Sequence Numbers
Creating the Sequence Table on the Database

 

Copyright © 1997, 2004, Oracle. All rights reserved.