Hi,
This is a response to #OJB201...
(http://scarab.werken.com/issues/id/OJB201)
I had spent some time earlier on the approach suggested in this issue but
did not post it for the reason documented below
I thaught it'll be better that others also understand the implications (of
Identity Column based SeqMgr )

Platform.getLastInsertIdentity() should not be implemented as described in
the defect !

The db/2 scalar function 'identity_val_local() ' does not take any
parameter...
it is supposed to return the value of last identity column that was
incremented !
The reporter of the defect has recommended using
"select identity_val_local() from <tableName> fetch first ro only"
however the above SQL has nothing to do with the <tableName>..

running it is as good as running: "values identity_val_local()" which does
not take any table name.
and it can make the usage of "values identity_val_local()" : potentially
dangerous:
in the following scenario:

-Table T1 uses Identity column (and used in O-R mapping)
-A Trigger is defined for INSERTS in T1 which inserts a record in T2 (T2
has nothing to do with OR business)
      (such approaches are there in many systems e.g. automatically
calculating summaries etc)
-both T1 and T2 use Identity columns.
-OJB inserts a record in T1 which leads to another record getting added to
T2
-"values identity_val_local()" will return the value of  identity column in
T2 and not T1, as required by the native based SeqMgr.

thanks
akhil




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to