-marckun
Paul Sturrock wrote:If you are using Hibernate could you not just use its built in versioning capabilities? If your mapped object does not have a version field a save will just overwrite without checking.
-marckun
-marckun
Marc Heruela wrote:
Paul Sturrock wrote:If you are using Hibernate could you not just use its built in versioning capabilities? If your mapped object does not have a version field a save will just overwrite without checking.
Ohh. Does he have one? Do you have some tutorial on this?? The very starter tutorial on timestamping?
Thanks a lot.
-marckun
the trouble is, when the user cancels the account (meaning the balance is restored), and the accounting department has set it transferring, the transferring now is in progress, and the account balance of the customer wont change (meaning, the balance was restored to the original unsubtracted amount, which implies the SYSTEM IS GIVING MONEY TO THE CUSTOMER).
Is it wise for me to do this:, when the user loads the record on the screen, the record will be locked.
Or would it be better to gain the lock when the "update" of the record is on progress.
Paul Sturrock wrote:
the trouble is, when the user cancels the account (meaning the balance is restored), and the accounting department has set it transferring, the transferring now is in progress, and the account balance of the customer wont change (meaning, the balance was restored to the original unsubtracted amount, which implies the SYSTEM IS GIVING MONEY TO THE CUSTOMER).
This sounds a little like the customer should not be allowed to cancel a request that has entered the transfering state? So could you not just change your business logic to prevent this?
Is it wise for me to do this:, when the user loads the record on the screen, the record will be locked.
Normally, pesimistic locking is frowned on, because it puts a bottleneck in the system. However given this is a specific user managing their own balance I'd say this is one of the few occasions where pesimistic locking may a good idea. If you go for this approach you no longer need optimistic locking (i.e. versioning) too. I suppose you have to consider how often something else other than the user changes the balance.
Or would it be better to gain the lock when the "update" of the record is on progress.
Yes. You don't want to indescimitately allow pesimistic locking. What I'd do is have an update screen that will reselect the data using a lock so you only get the lock when you are anticipating an update.
-marckun
Space pants. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|