Here is a different view to the problem.

I have a bulk export-import routine that exports all the tables into .del files for backup using SYSCS_UTIL.SYSCS_EXPORT_TABLE and SYSCS_UTIL.SYSCS_IMPORT_TABLE procedures.

The export-import worked just fine until I realized that I cannot INSERT into any of the tables that have IDENTITY columns. This is because while importing all the identity columns are filled "manually".
So, the autoincrement counter is still at 0 while there already are rows with higher values.

I worked around that issue by using 'ALTER TABLE columnName ALTER COLUMN columnName RESTART WITH (current_max + 1)'.

But this proves that the current derby behavior is misleading if not wrong (no matter what the specs suggest). Derby SHOULD generate a unique id value.

I am pretty sure that, for someone who is familiar with the code fixing the bug will be quicker and less painful than continuing with this debate.

Thanks
-Ateesh