0

I have a client server application. Assume I work as a Support executive, resolving customer tickets. We(our support team) have got two tickets to work on.

Ticket 1: Client "Liver" raised a ticket to update his phone number.
Ticket 2: Same Client "Liver" raised a second ticket to update his email ID.

I am working on ticket 1:

Opened application, clicked edit Customer Info buttton, entered new phone number. I did not save the form(Edit form). In between, I left for CUPPA.

My colleague is looking at ticket 2: He has edited the Customer information and updated with new email id: Its persisted in database.

When, I come back and save my ticket with phone number update, it would overwrite his changes i.e.., his email ID change is lost or not updated for that Customer "Liver".

Is there a way that when a get back to my work/page after CUPPA break, can I see the email ID with updated value?

How to prevent this? What is the approach? Possible design ideas? How to ensure that there is no data loss?

1

1 Answer 1

1

The two easiest ways of preventing this from happening are

  1. Use a form of (user-level) locking on the database.

    When you load the information of the client "Liver" into the form, a marker is placed in the database that client "Liver" is currently being edited (and possibly by whom). When your colleague tries to load client "Liver" as well, he would then be informed that you (or someone) are already editing client "Liver" and that he can't access the data for that reason. When you finally submit your changes, then the 'editing flag' would be removed from the database.

  2. Use versioning of the data.

    In this scheme, each data-set in the database gets a revision number that is incremented with each update. In the described scenario, both you and your colleague would start with the data of revision 42 of client "Liver". As your colleague is first with saving, his changes are accepted immediately and the become revision 43. When you try to save, the database layer would notice that your changes are based on revision 42, but the current revision is 43, so your changes are rejected. Then the application can retrieve version 43, try to merge your changes into that version and inform you that someone else already made changes. You can then double check if your change is still valid and try to save again.

    The main difference with what you asked for is that the update of the form on your side is delayed until you try to save.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.