In ESB and BPEL projects you can use and configure a database adapter to, among others, insert data into a database. TopLink is used to implement this. In the generated TopLink mappings you can specify if you want to use sequencing, either native sequencing or a sequence table. If you want to use Oracle database sequences you need to:
- Create the database sequence(s) in the Oracle database.
- Select “Use Native Sequencing” in the “Database Info” tab of the TopLink map.
- For each entity for which you want a field to be generated using sequences: configure the database sequence name and the entity fields which need to be populated. This can be done in the “Use Sequencing” tab of the Toplink mapping for that entity.
Finally, make sure that:
- The preallocation size in the TopLink map is equal to the increment by value of the Oracle database sequence.
- The TopLink sequencing settings match those of the Database Adapter Connection Factory settings configured in the OC4J container. This one can be tricky, since for “normal” Java/JEE projects you probably do not need to configure this.