how to check if the record exists in the table

Newton21205
Newton21205 used Ask the Experts™
on
I'm using jdbctemplate.update to insert a record in the database.

public void write(List<? extends Person> persons) throws Exception {
            LOGGER.debug("Entering<---");
            personList.addAll((Collection<? extends Person>) persons.get(0));
            for(Person person:personList) {
                  jdbcTemplate.update(INSERT_PERSON_INFO, new Object[] {Integer.parseInt(person.getID()),person.getPassword(),person.getUserName());}
            LOGGER.debug("Exit  --->");
      }


So I want to modify the code to not allow any duplicate entry into the database and instead update the existing record.

Any help would be appreciated?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial