Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of Transaction #65

Open
valentinacupac opened this issue Dec 30, 2022 · 1 comment
Open

Use of Transaction #65

valentinacupac opened this issue Dec 30, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@valentinacupac
Copy link
Owner

Discussed in https://github.com/valentinacupac/banking-kata-java/discussions/54

Originally posted by ldauvilaire August 23, 2022
Storage (i.e. Database) transactions have to be managed or else data integrity can be broken in case of access in parallel.

The use cases : DepositFundsUseCase and WithdrawFundsUseCase shall use only one transaction (read and update done into the same transaction).
The current code is using 2 (implicit) transactions, one for reading (repository.findRequired(accountNumber)) and another one for updating (repository.update(bankAccount)), this would not work in a "real" bank.

Of course the @transactional shall not be implemented into the domain but into driven port(s).
May be a "TransfertFund" from one account to another would help to show the problem in evidence.

@valentinacupac
Copy link
Owner Author

Thanks @ldauvilaire, I created a ticket here based on your post.

@valentinacupac valentinacupac added the enhancement New feature or request label Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant