so did I understand you right? If using SequenceNativeImplManager, my workaround is the only solution being available and when I want to have a "little bit more comfort" with my id's I shall use SequenceMangerNextValImpl? Or should one consider to always use SequenceMangerNextValImpl when operating on a db2 with autoincrement?
greetz Dirk -----Ursprüngliche Nachricht----- Von: Armin Waibel [mailto:[EMAIL PROTECTED] Gesendet: Sonntag, 18. Januar 2004 23:57 An: OJB Users List Betreff: Re: How to get a generated ID before an object is stored? Hi Dirk, Dirk Manske (Service Respond) wrote: > Hi, > > I am using PB with DB2 and autoincrement set on. OJB is setup with the > SequenceNativeImplManager. My question is, I know that there is a way > to retrieve an ID for an object before it gets stored! yep, OJB use intern an unique Identity object for each pc object. > I read it somewhere but > - unfortunately - cannot find the source anymore. Maybe in docs for SequenceManagerNativeImpl http://db.apache.org/ojb/sequencemanager.html#nativeSequenceManager > I assume I have to use the > class Identity? Any help is appreciated. My temporary workaround is to > store the object and retrieve it back immediately (with the oid), but > this seems not to be the best way... It's the only way I know get the real UID of the Identity column. That's one reason why I don't like Identity columns. As far as I know does DB2 also supports database based sequence key generation (SequenceMangerNextValImpl). This also guarantee the consistence of the data (when other applications as OJB do operate on the DB) and has the advantage that we can request a unique id before the object will be written to DB. regards, Armin > > thx, > Dirk > --------------------------------------------------------------------- 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]