Query for object,
Student student = return jdbcTemplate.queryForObject("select * from student_id = ?", new Object[] { studentId }, studentRowMapper);
For query,
List<Student> students = return jdbcTemplate.query("select * from class_room_id = ?", new Object[] { classRoomId }, studentRowMapper);
Both jdbcTemplate.queryForObject
and jdbcTemplate.query
are deprecated in spring boot 2.4.X above
As explained in the javadoc of the class as well as in the upgrade/migration guide it explains that you should use the varargs method.
jdbcTemplate.queryForObject("select * from student_id = ?", studentRowMapper, studentId);
and
List<Student> students = return jdbcTemplate.query("select * from class_room_id = ?", studentRowMapper, classRoomId);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With