I have 2 User tables and Role . And since the relationship between them is much to many there is a third table User_role .
When updating the user, how to write the query correctly so that from the beginning in the user_role table all the records for the given user were deleted, and then new ones were recorded (which arrive when the user finds)?
Now I’ll have a user update for now, without affecting the third table:
"UPDATE \"user\" SET email = ?, first_name = ?, second_name = ?, last_name = ?, password = ? WHERE id = ?";