Relational databases and SQL are time-tested and proven data storage mechanisms. Unlike other ORM frameworks such as Hibernate, MyBatis encourages the use of SQL instead of hiding it from developers, thereby utilizing the full power of SQL provided by the database server. At the same time, MyBatis eliminates the pain of writing boilerplate code and makes using SQL easy.
Embedding SQL queries directly inside the code is a bad practice and hard to maintain. MyBatis configures SQL statements using Mapper XML files or annotations. In this chapter, we will see how to configure mapped statements in Mapper XML files in detail; we will cover the following topics: