Solved

how to check if the record exists in the table

Posted on 2016-07-14
2
43 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 41711550
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

726 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