About
Pricing
Community
Teams
Start Free Trial
Log in
Nika Gudge
asked on
7/14/2016
how to check if the record exists in the table
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((Collect
ion<? extends Person>) persons.get(0));
for(Person person:personList) {
jdbcTemplate.update(INSERT
_PERSON_IN
FO, new Object[] {Integer.parseInt(person.g
etID()),pe
rson.getPa
ssword(),p
erson.getU
serName())
;}
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?
Java
Java EE
MySQL Server
1
1
Last Comment
CEHJ
8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
CEHJ
7/14/2016
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck