Chapter 8 Creating J2EE Applications for BEA WebLogic
Generated primary key support for Oracle databases use Oracle's SEQUENCE. This feature works with a sequence entity in the Oracle database to generate unique primary keys. The Oracle SEQUENCE is called when a new number is needed.
Once the SEQUENCE already exists in the database, you specify automatic key generation in the XML deployment descriptors. In the weblogic-cmp-rdbms-jar.xml file, you specify automatic key generation as follows:
<automatic-key-generation> <generator-type>ORACLE</generator-type> <generator_name>test_sequence</generator-name> <key-cache-size>10</key-cache-size> </automatic-key-generator>
You need to specify the name of the ORACLE SEQUENCE to be used, via the generator-name element. If the ORACLE SEQUENCE was created with an INCREMENT value, then you must specify a key-cache-size. This value must match the Oracle SEQUENCE INCREMENT value. If these two values are different, then you will most likely have duplicate key problems.
| Copyright (C) 2005. Sybase Inc. All rights reserved. |
| |