How to do it...

  1. We will copy the Person class from the previous recipe:
        public class Person {          private Integer id;          private String firstName;          private String lastName;          private String place;          //required getters and setters        }
  1. We will do the PersonMapper part in a different way. We will write all our SQL queries in a mapper XML file and then refer to them from the PersonMapper interface. We will place the mapper XML under the src/main/resources/mappers folder. We'll set the value of the mybatis.mapper-locations property to classpath*:mappers/*.xml. This way, the PersonMapper interface can discover the SQL queries corresponding to its methods.
  2. First, let's create the com.packt.boot_rest_demo.PersonMapper interface:
        @Mapper public interface ...

Get Java 9 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.