Explain how the update method in JdbcTemplate can be used to perform insert, update and delete operations.

Explain how the update method in JdbcTemplate can be used to perform insert, update and delete operations.

Ninja Asked on 19th September 2018 in Spring DAO.
Add Comment
1 Answer(s)
Best answer

The update() method in JdbcTemplate can be used to perform insert, update and delete operations as shown below:

  1. Insert Operation
this.jdbcTemplate.update("insert into employee (empid, empname) values (?, ?)", 1000L, "James");

  1. Update Operation
this.jdbcTemplate.update("update employee set empname = ? where empid = ?", "Jeff", 1000L);

  1. Delete Operation
this.jdbcTemplate.update("delete from employee where empid = ?", Long.valueOf(empId));

Ninja Answered on 19th September 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.