Oliver Nautsch wrote:
Thanks for you hints! We want to do it exactly this way (DAO-Layer, equals, hashcode, unicity constraints). But what do you think about the migration of the data? We have to fill up the new primary key for each record and what do you mean with "... (not assigned) ..."?
I use this way to add generated primary key:
1. add nullable field to table.
2. execute update statement
"UPDATE MY_TABLE SET PK = nextval('mySec')" from UI or command line client.
3. Alter table to make this field not null and add primary key constraint.
(It is not the rocket science, you will find how to write commands in doc)
This schema change doe's not break legacy code (if SQL is static), it helps to port code too, you will get working application on new chema woth old data and it must help to detect problems if you will break something with migration.