db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "nntp://news.gmane.org/gmane.group.name" <r1ak...@in.ibm.com>
Subject More on Identity columns in db/2
Date Fri, 05 Sep 2003 15:41:52 GMT
I came back to this topic again and realised that INSERT statements in OJB
are always
trying to send the PK column also in the query.
That being the case, How do we use "SequenceManagerNativeImpl" ?
The two dbs that I know (SQLServer and db/2) do not allow u to pass the
value for an Identity Column in SQL statement.
Am I missing some thing ?


"Akhil Kumar" <r1akhil@in.ibm.com> wrote in message
> 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
> T2 and not T1, as required by the native based SeqMgr.
> thanks
> akhil

To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org

View raw message