Whenever I am inserting the person, I want to get the id of the last person, and automatically increment it by 1 and if it doesn't exist give id of 1. Where do I need to set this up, and what do I need to use? I think it should be done in the getter or?
Person with getters and setters
public class Person {
int id;
int name;
}
Person Data Access Object
public Person addPerson(Person person) {
String sql = "INSERT INTO people (id, name) values (?, ?);"
jdbcTemplate.update(sql, person.getId(), person.getName());
return person;
}