Hi
I'm working with a legacy Sybase db, and for record keeping purposes, we don't actually delete most rows, but instead each table has a status (int) column that is set to 0 for rows no longer 'valid.'
This is breaking Hibernate in many places:
1. All loads/selects have to be overridden to ignore rows 'where status = 0.'
Not that big of a deal - seems best to set the 'where' attribute to 'status > 0.'
2. All deletes break b/c I now have to change the status instead of deleting the row.
3. Inserts don't work right b/c I have to check for previously 'deleted' rows that still exist though the status has been set to 0, otherwise I will insert a duplicate row (with only differing status). Essentially there is the possibility to create infinite duplicates if the same association is continuouslly added and deleted.
Triggers on create/delete that call stored procedures seem like the best way to deal with this as Hibernate wouldn't have to know much besides to load only those entites with status != 0, but if someone has worked this problem before, I'm all ears...
Thanks
Bill
|