Hi,
Concurrency is always very important in all situations if you hope to build stable & accurate applications.
Is it really possible that someone will have closed the account between you checking if it is open
How could I check it? That is my question
If you mean , I check it when I open the service screen / form, then I can’t depend on this because I don’t know how much time between opening the form and saving it.
If you mean, I check it inside transaction with repeatable read, then this is always not recommended specially in busy systems. And my question is how to avoid this if I can.
**By the way, this should be a common situation in most business applications **
For example
-
Checking Credit Limit (max amount for a client to purchase by credit) for client before creating credit sales invoice for him. Specially if you have multi physical stores
-
This also could happen in a pointing system common in POS (Point of Sales) where the buyer takes points in every purchase and later it could get a discount depending of these points
-
In my situation, the account table represents a medical account in hospitals. In busy day, it could happen (and it really happen) that the nurse try to add service (Operation Materials) on the account, while the accountant have already closed the account to calc patient invoice.
IN all the above situations, The Credit Limit, Points per customer, Account per Patient are stored in master tables while the transaction stored in another one. You must check them on every save for any transaction.
Thanks.