I have a web page where there is one checkbox field and it works fine when user checks few value and save. But problem occurs when an user again opens the form and uncheck few value and save it. In this situation i want to update the table with the current selected data and delete the unchecked data which is already stored in DB. I am searching for a solution using Spring JPA to handle it. Note- On click of save i am getting the entity with the checked data only.
Ex- I have one Employee entity and it has benefits attribut. In my ui suppose one employee opted(checked)for transport, gym, food and saved. Again if that employee want to modify his benefits list then he unchecked gym from the list. In this case on click of save my employee object contains only transport and food. Now I want my employee update method to delete gym from the benefits table. I am facing problem bcoz my emplee object contains checked data only. Let me know if you want more information.
ASSUMING you have passed an array/list of items to your controller and passed through to a Service method, the core of your solution MIGHT look something like this:
Let me know if this helps.
[UPDATE responding to comment:] So what I called "Thing" might better be called EmployeeBenefit, child of Employee or cross-reference between Employee and Benefit (which is a 3rd static reference table containing the codes and ids for transport, gym, food etc). It would seem that the solution requires your client form to submit ALL of the EmployeeBenefit records including those marked for deletion, something like this:
What is your client technology that calls your Spring Boot app?