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]
