How to do it...

  1. 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.
  1. Create the com.packt.boot_rest_demo.PersonMapper interface:
        @Mapper        public interface PersonMapper { public ...

Get Java 11 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.