I am writing a web application in Java. Login required. To do this, create a table Users in the database. In the system itself (Phonebook), the user makes entries (names, phone numbers, addresses) - for this, he created the second table Entries.

What is the best way to ensure that the user sees only his records, only which he himself created?

  • In the table of telephone records add a foreign key to the user who created the record. During data operations, check the correspondence of the author and the current user. - Sergey Gornostaev
  • I myself should then register this logic in the controller? Can it be somehow less time consuming through sessions for example? - user268117
  • Yes, there is to write something two or three lines. - Sergey Gornostaev
  • thank. I understood you. - user268117

0