Thomas Dudziak wrote:
On Tue, 6 Apr 2004, Guido Beutler wrote:
Can I choose the sequence implementation per class?
There are only a few tables which uses DB sequences. For all other tables the NextValImpl is ok.
The problem is that only a few tables use DB sequences.
Nope, currently not, though for an application you should choose how the pk values are generated, and stick to this method for all tables, anyway.
SequenceManager implementations can only set per database (per jdbc-connection-descriptor). If you really need this you need a special SM implementation for managing different SM.
If you interested I will try to write an alpha version of such an implementation.
So if you have a mixed scenario where some pk values shall be generated by the database (sequences), and other come from the application, then I think you probably should use the NextValImpl like this (Armin, please correct me if I got it wrong):
* specify NextValImpl in your connection descriptor with autoNaming='true' if you only need one sequence, or with autoNaming='false' if you require multiple sequence
autoNaming 'true' means that OJB build a sequence name for each field-descriptor (parent class-descriptor) automatic, except the sequence name was specified in the field-descriptor
file:///E:/intellij/OJB_Experimental/db-ojb/target/doc/sequencemanager.html#sequenceName
'false' means OJB does not try to build a sequence name and if no sequence name was set in field-descriptor an exception was thrown.
regards, Armin
* in the repository descriptors, specify the database-generated pk fields as autoincrement='true' and with the sequence-name if you have autoNaming='false' in the above step
* in the db table schema don't specify the database-generated fields as identity (whatever the syntax in DB2 is for this) but as a normal non-pk field (except for NOT NULL which should be present). Also do not connect the sequences to the pk-fields in the database, this is done by the sequence manager.
Tom
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
