Reputation: 61
My application working in a multi-users environment for medical records. One of the important parts of the application is writing the medical records, doctors should always review the current written data then adding or correcting any information's as needed.
I were aware about the situation when 2 doctors (A,B) viewing the data at same time, one of them will make changes and hit save (A).
the other doctor (B) still editing the old data & he don't know about the changes applied by doctor (A).
When doctor (B) hit save, the application will compare the Version column in the database, application then return an error message ("Data has been changed by another user !!!").
My Question in this case: What choices should be available within my solution.
I'm seeking an professional solution or idea from your experiences.
My application using: Java Swing for end user client & MySQL database.
Upvotes: 3
Views: 165
Reputation: 9179
suggestion: send a real time notification
if A makes changes and hits save you could send a message "Data has been changed by another user !!!" immediately to B before B saved his changes.
This approach is similar to stackoverflow. As I write my answer, you can change your question and I will get a message
an edit has been made to this post; click to load
So if A,B,C... open data set D, they should register themselves as observers. You can implement this approach by using websockets or polling.
Upvotes: 0
Reputation: 1820
Doctor B should absolutely be notified in some way that the record has been modified since he opened it. The rest is up to you/the requirements of the program. Does it matter if Doctor A's changes are overwritten? Would it be better to have Doctor B view the changes made by Doctor A, and then decide if the changes (made by Doctor B) should still be saved? Should the changes be merged? It all depends on what you decide to design, as well as any requirements that may be imposed on the system you are creating. Without more detail on the system you are designing or its requirements, it would be impossible to provide a specific answer.
Upvotes: 2