Hello everyone,
I am doing a small application to learn how to use MySQL, the MVC
pattern and
Java in general. The application in question is a simple frame that connects to a MySQL database which contains a table that stores the expenditure incurred by a family (the fields are date, transaction type, amount, notes) and displays it using a JTable. Several JCombo allow the user to filter the transactions by year / month / type.
The paging that I would use is the classic next/previous button and a label that shows the current page number out of a total of n pages. A further JCombo allows the user to choose the number of lines per page.
Now I can do this type of paging with a first query that counts the total number of records (to calculate the total of pages) and a subsequent query with LIMIT clause to show results.
Then insert the buttons for the "Add operation", "change operation" and "delete operation." The addition and modification are then carried out with a new frame. But at this point I'm stuck.
The question that haunts me and that I can not solve is the following: if I'm flipping through the pages on my pc while my wife with her pc is inserting / modifying / deleting an expense, my pagination may fail.
How handles the paging while multiple users are connected simultaneously reading and changing values to the same table?
I hope I have explained understandably the problem. Thank you for your help.