@Test publicvoidtestInsert(){ int rows = jdbcTemplate.update("insert into student values(?, ?)", "tom", 18); System.out.println(rows); } @Test publicvoidtestUpdate(){ int rows = jdbcTemplate.update("update student set age = 2211 where name = ?", "tom"); System.out.println(rows); } @Test publicvoidtestDelete(){ int rows = jdbcTemplate.update("delete from student where name = ?", "tom"); System.out.println(rows); } @Test publicvoidtestQueryAll(){ List<Student> students = jdbcTemplate.query("select * from student", new BeanPropertyRowMapper<Student>(Student.class)); System.out.println(students); } @Test publicvoidtestQueryOne(){ Student tom = jdbcTemplate.queryForObject("select * from student where name = ?", new BeanPropertyRowMapper<Student>(Student.class), "tom"); System.out.println(tom); } @Test publicvoidtestQueryCount(){ int count = jdbcTemplate.queryForObject("select count(1) from student", int.class); System.out.println(count); } }