Since I'm not reusing deleted record numbers, and I don't want to refresh data object cache again and again, what I'm doing is:
1) When a record is deleted, simply modify a flag
2) Never use that record number
However, at GUI level, how should I handle it?
e.g. If I removed 1st record, then when a user wants to read all records, the first record in result table is actually record number 2. So, how to map this? When user 'books' a record, he/she will simply provide new data for a record. So which approach should I follow?
1) Add a recNo field in data object. This field will be set while retrieving the record and will be referred for further operations. I'll also show this recNo in display table (though it will look a little weird if user see first record with recNo 2 - in case 1st record is deleted)
2) Since 'delete' is not a 'must' requirement, I simply won't care about this (and assume that first record is recNo 1 and so on)
I personally think that I should still go for 1st approach (since 'assumption' might be risky). Any suggestions?
I didn't include a recNo in the data object but the record numbers (from the database) is displayed in the GUI, this allows me to code the logic that gets the actual selected record using the table model's getValueOf(row, 0). I also provided a filter in the GUI to remove deleted records from the table model.