Title: Message Title
|
|
|
|
Optimistic locking has now been enabled for savings accounts.
The same can be tested as follows:
Create a savings account with a balance of 100 and try running two concurrent withdrawal transactions on the same, the second transaction should now fail
Locate the following code snippet (currently line number 88,89) in method handleWithdrawal(...) of SavingsAccountDomainServiceJpa.java and add breakpoints on both lines.
{code} saveTransactionToGenerateTransactionId(withdrawal); this.savingsAccountRepository.save(account); {code}
Next trigger a withdrawal request , Ex: https://localhost:8443/mifosng-provider/api/v1/savingsaccounts/1/transactions?command=withdrawal with json body
{code} {"transactionDate":"02 December 2014","transactionAmount":"100","locale":"en","dateFormat":"dd MMMM yyyy"} {code}
You can then let this thead thread (request 1) to now proceed to the second breakpoint. Trigger another requests (request 2) which pauses would pause at break point 1
Let request 1 proceed to completion. Now, let request 2 proceed, it should fail with an exception similar to
{code} Object of class [org.mifosplatform.portfolio.savings.domain.SavingsAccount] with identifier [1]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) : [org.mifosplatform.portfolio.savings.domain.SavingsAccount#1] {code}
|
|
|
|
|
|
|
|
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Mifos-issues mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mifos-issues