O'Reilly logo

Java Persistence with MyBatis 3 by K. Siva Prasad Reddy

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

Chapter 3. SQL Mappers Using XML

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:

  • Mapper XMLs and Mapper interfaces
  • Mapped statements
    • Configuring ...

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