Chapter 8 Creating J2EE Applications for BEA WebLogic
Generated primary key support for unsupported databases use a Named SEQUENCE TABLE to hold key values. The table must contain a single row with a single column that is an integer, SEQUENCE INT. This column will hold the current sequence value.
Once the NAMED_SEQUENCE_TABLE 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>NAMED_SEQUENCE_TABLE</generator-type> <generator_name>MY_SEQUENCE_TABLE_NAME </generator-name> <key-cache-size>100</key-cache-size> </automatic-key-generator>
You need to specify the name of the SEQUENCE TABLE to be used, with the generator-name element. Also, you can specify the optional size of the key cache, which will tell you how many keys the container will fetch in a single DBMS call using the key-cache-size element.
For improved performance, we recommend that you set this value to >1, a number greater than one. This will reduce the number of calls to the database to fetch the next key value.
Also, we recommend that there only be one NAMED SEQUENCE table per bean type. Beans of different types should not share a common NAMED SEQUENCE table. This will reduce contention for the key table.
Copyright (C) 2005. Sybase Inc. All rights reserved. |
![]() |