O'Reilly logo

Java 9 Cookbook by Nick Samoylov, Mohamed Sanaulla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required