Solved

how to check if the record exists in the table

Posted on 2016-07-14
2
20 Views
Last Modified: 2016-08-28
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?
0
Comment
Question by:Newton21205
2 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 41711550
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
The viewer will learn how to implement Singleton Design Pattern in Java.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now