Database concurrency conflicts are not handled
baratgabor opened this issue · 0 comments
baratgabor commented
Even though this is just a sample application, it doesn't seem prudent that currently it makes no effort to handle database concurrency conflicts.
If two new Transactions (referring to the domain entity Transaction, which involves changing product stocks) were to be created in an overlapping manner, it would be currently possible for the stock count to be corrupted, because the last Transaction write to complete would overwrite the modifications of the first.
Task:
- Implement optimistic or pessimistic concurrency handling.
- At the very least cover new Transactions.
- Consider if simple entity updates (e.g. Product, Partner) would also need to be covered.
- Even if optimistic concurrency handling is chosen, it would be probably prudent to still expose transaction begin/commit methods in the UOW component, with an appropriately selected isolation level (to be able to start a transaction directly when we select an entity from the database).