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

First, let's look at how the PersonMapper interface discovers the SQL statements to execute. If you look at src/main/resources/mappers/PersonMapper.xml, you will find that the <mapper> namespace attribute is org.packt.boot_rest_demo.PersonMapper. This is a requirement that the value of namespace attribute should be the fully qualified name of the mapper interface, which, in our case, is org.packt.boot_rest_demo.PersonMapper.

Next the id attributes of the individual SQL statements defined within <select>, <insert>, <update>, and <delete> should match the name of the method in the mapper interface. For example, the getPersons() method in the PersonMapper interface looks for an SQL statement with id="getPersons"

Now the MyBatis ...

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