Toactivatepessimistic locking, we regenerate theservice classes. It is
enough togenerate the Account,CheckingAccount,and SavingsAccount
classes.
Note:You might wantto version theitso.bank.persistence.service package
before regenerating the serviceclasses. This makes it easy to go backto the
previous implementation.
Generation createsnew methodsin the ItsoBankItsobankAccountQueryPool
class, for example, singleLockSqlString:
public java.lang.String singleLockSqlString() {
return "UPDATE ITSO.ACCOUNT SET ACCID = ACCID WHERE ACCID = ? ";
}
Test Pessimistic Locking
Totest thepessimisticlocking ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.