0

In a Put Request the JSON file should be checked for all entries and this should be compared with the database. I have a variable that has the last database entry, e.g. the database has two entries, but there are three entries in the JSON file. In this batchUpdate the query creates three entries, but I only want to add the last (the third) entry. How can I do this?

If I use an If( i >= db.size()) the query creates three entries or it says the two entries are missing

I could change the Company company and delete the two entries there, but how do I do that?

   new BatchPreparedStatementSetter() {


                public void setValues(@NonNull PreparedStatement ps, int i) throws SQLException {
                
                        ps.setInt(1, employeeId);
                        ps.setString(2, company.getEmployee().get(i).getFirstName());
                        ps.setString(3, company.getEmployee().get(i).getSurName());
                        ps.setString(4, company.getEmployee().get(i).getPhoneNumber());
                        ps.setString(5, company.getEmployee().get(i).getMobileNumber());
                        ps.setString(6, company.getEmployee().get(i).getFaxNumber());
                        ps.setString(7, company.getEmployee().get(i).getMailAddress());

                }
  • Can you include the complete set of code? I don't see a variable `db` or a line with `Company company`. Probably would help to include the JSON that you are talking about. What have you tried? – Kirby Dec 08 '20 at 17:25
  • I've solved it!! :) – DevQuixel Dec 08 '20 at 17:57
  • @DevQuixel if you have solved it, it is a good practice to post your answer below, so that every person that encounters the same problem as you, can solve it too :) – Renis1235 Dec 09 '20 at 09:54

0 Answers0