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
Solved

how to check if the record exists in the table

Posted on 2016-07-14
2
36 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AWS EC2 & RDS Instance 5 50
sql import cannot be resolved jsp 3 44
Glassfish admin console not working 1 32
How to fix Datetime in MySQL? 4 47
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
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.
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

791 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