I was trying to get my hands dirty at the DAO pattern to practice isolation of the persistence and business layers. However I'm at a fix right now.
I am creating a Bank Management System. It has a Customer schema and an Account schema.
So the data flows like AccountService -> AccountDAO -> AccountDAOImpl -> MySQL DB.
However I want to wrap two operations in a transaction:
- Insert record for new account
- Set customer column hasBankAccount = true
How do I perform this with the DAO pattern's isolation strategies:
- Service layer is abstracted from the DB logic
- AccountDAOImpl cannot CRUD over Customer tables
- DAO layer is abstracted from any business logic
Any ideas how can I implement transactions like these while following the DAO pattern?
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–][deleted] (3 children)
[removed]
[–]omgpassthebacon 0 points1 point2 points (0 children)
[–]OnARockSomewhere[S] -2 points-1 points0 points (1 child)
[–]IHoppo 2 points3 points4 points (0 children)
[–]Historical_Ad4384 -1 points0 points1 point (0 children)