This key generator class uses a special table to maintain primary keys. The table has to contain an ID column (integer ) and a name column ( varchar or char ). The following statement generates such a table:
create table TSEQUENCE (SEQ_ID integer, SEQ_NAME varchar(20))Inside the name field all sequences will be listed during Signsoft intelliBO usage. A sequence with name persontable and an initial value of 100 could be created like this:
insert into TSEQUENCE values (100, "persontable")When looking at the Person class and the sequence table provided below, one could declare the Person class with the following JDO segment:
...
<class name="Person">
<extension vendor-name="ssibo" key="jdbc">
<!-- key generator for id field -->
<extension vendor-name="ssibo" key="objectid-generator">
<extension vendor-name="ssibo" key="class-name"
value="com.signsoft.ibo.core.services.identity.jdbc.SequenceTable" />
<extension vendor-name="ssibo" key="table-name" value="TSEQUENCE" />
<extension vendor-name="ssibo" key="id-field" value="SEQ_ID" />
<extension vendor-name="ssibo" key="name-field" value="SEQ_NAME" />
<extension vendor-name="ssibo" key="pre-allocation-size" value="10" />
<extension vendor-name="ssibo" key="sequence-name" value="persontable" />
<extension vendor-name="ssibo" key="field-name" value="id" />
</extension>
</extension>
...
</class>
...
Whenever a new object is inserted using makePersistent(), Signsoft intelliBO maintains the id value of the table. The name of the key generator class is required. If datastore identity is used, it is com.signsoft.ibo.core.services.identity.jdbc.SequenceTable and for application identity it is com.signsoft.ibo.core.services.identity.jdbc.ApplicationIdSequenceTable .
The following parameter elements can be declared:
| Parameter | Description | Mandatory |
|---|---|---|
| class-name | name of the key generator class (please note the different class names for different object identities) | Yes |
| table-name | identifier of the key table | Yes |
| id-field | identifier of the ID field in the key table | Yes |
| name-field | identifier of the sequence name field in the key table | Yes |
| pre-allocation-size | specifies how many keys should be allocated at once | No, default: 1 |
| sequence-name | name of this sequence | Yes |
| field-name | name of the object's primary key attribute* | Yes |
* Note that the JDO specification notation for object attributes differs from the notation used in this user guide. According to the JDO specification, every object attribute is called an "object field". In compliance with the JDO specification notation, this element is called "field-name". If you use datastore identity with an own key field in your data object, then you should specify this attribute name for the property "field-name". With hidden datastore identity you must specify the column name.
Please note: The default sequence generator of Signsoft intelliBO is NOT suitable for the use in a distributed environment (several instances of Signsoft intelliBO at the same time). We suggest to rather using a database specific sequence generator in this case. During runtime the use of a database specific sequence generator is preferable in general.