Generatedkey in DB2

53 views Asked by At

We have a table in DB2 with primary key auto generated. When I run

SELECT IDENTITY_VAL_LOCAL() as ID FROM SYSIBM.SYSDUMMY1 

in the same session of AQT just after the insert, it gives us the ID of the record just inserted.

problem is with iBatis. When we use iBatis 2 as below

<selectKey  resultClass="int" keyProperty="id">
 SELECT IDENTITY_VAL_LOCAL() as ID FROM SYSIBM.SYSDUMMY1
 </selectKey>

it doesn't return anything , hence causing NullPointer.

can someone please provide any input if you have any idea what is required to do this operation in DB2.

Thanks, Rajesh

Need to capture the ID of last record inserted in DB2 using iBatis2.3.4

0

There are 0 answers