This is a Java, JavaFx & sql problem.
I am in a pickle right now. This is hypothetical. So no code to begin with yet. I just want to find out the best way to approach this problem.
Background: A program that displays info data from user. This inlcudes, firstname, lastname, address, phone number. This info changes a lot. So users will be deleted & added on a daily basis.
So here is the issue: I want to get the number of users to be shown in the TableView under the "number of users" table column. How should I approach this issue? Should I get the number of users from sql via the primary key? Or should I count the number of rows from sql? Or should I just count it with the tableview.size() function in java? I want it to adjust to the number of columns being added or deleted. From my experience if I use primary key from sql it will just continue with the number.
For example: if I have 5 users in sql database: 1,2,3,4,5. If I delete users 2 & 3 it will be 1,4,5. And if I add new users it will be 1,4,5,6. I want it to be 1,2,3,4 instead.
How can I solve this problem?