General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Rich,
>> it would make more sense to the user (and to me now that Bob mentioned it) to force saving any
parent before adding any children for it.<<
This was my first guess, but I think you run into problems.
First, if the user wants to revert a new record, you have to convert that to a delete in code. Not the worst thing in the world, but worse...
....is the possibility of saving invalid records, records that break business rules. Let's say you don't want a Sales Order saved without a sale amount. Well, you can't have a sales amount until you enter a line item.
You might then say, well, OK, I'll put some switches in there to bypass validation when line items are being added, but enforce it when the user himself excplicitly attempts to save the header. I had no choice but to do this with a commercial framework I use, but I hate the fact that invalid headers are in the base table. Power outages, etc., can lead to bad data in the tables.
It seems to me that if you accept the must-save-parent philosophy, you have to translate all business rules so that they don't conflict with this technical requirement.
>> (That includes saving 'children' before adding 'grandchildren'.) <<
It actually generalizes more than that. Given any n-level heirarchy where n is 4 or greater, the problem repeats itself for each 3-level subset of the heirarchy.
>> Interesting discussion, again, I'm glad we're having it.
I'm very glad we're having it <s>, I'm learning a lot.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only