-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Status columns instead of Deleting row
PostPosted: Wed Dec 05, 2007 1:53 pm 
Newbie

Joined: Wed Dec 05, 2007 1:30 pm
Posts: 5
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.