Sundararaj Govindasamy Sundararaj Govindasamy - 11 months ago 70
Java Question

Why there is no insert() in Spring JDBCTemplate?

I noticed that Spring JDBCTemplate is using update() method for insert,update and delete operations.

I am curious to know Why methods like jdbcTemplate.insert() and jdbcTemplate.delete() are not available?

Any good reasons behind this design decision?


As you may know Spring JDBCTemplate intended for boilerplate termination. To be more specific here is the table

So basically saying they don't invent something new. It's some kind of wrapper. And if you will look inside jdbcTemplate.update(..) you will see java.sql.PreparedStatement that has only executeUpdate() executeQuery() execute().

executeQuery()for getting the data from database

executeUpdate()for insert,update,delete

execute() any kind of operations

So each method responsible for particular SQL queries.