INSERT Query

Learn how to insert a record in the database using the JdbcTemplate class.

We'll cover the following

In this lesson, we are going to learn how to write to the database using the methods of the JdbcTemplate class.

JdbcTemplate update() method

To insert a row, we need to send a Player object as input parameter.

The update() method is used for an INSERT query. This method takes the SQL query as well as an array of objects containing the values that will be inserted. The method returns an int value which shows the number of rows affected by the query.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.