MyBatis Introduction

Manish Saini
2 min readFeb 2, 2021

Here we cover following topics:

  • What is MyBatis?
  • Why MyBatis?

What is MyBatis?

MyBatis is an open source persistence framework that simplifies the implementation of the persistence layer by abstracting a lot of JDBC boilerplate code and provides a simple and easy-to-use API to interact with the database.

MyBatis was formerly known as iBATIS and was started by Clinton Begin in 2002.

MyBatis 3 is a complete redesign of iBATIS, with annotations and Mapper support.

The main reason for the popularity of MyBatis is its simplicity and ease of use. In Java applications, the persistence layer involves populating Java objects with data loaded from the database using SQL queries, and persisting the data in Java objects into the database using SQL. MyBatis makes using SQL easy by abstracting low-level JDBC code, automating the process of populating the SQL result set into Java objects, and persisting data into tables by extracting the data from Java objects. If you are currently using iBATIS and want to migrate to MyBatis, you can find the step-by-step instructions on the official MyBatis website at

https://code.google. com/p/mybatis/wiki/DocUpgrade3 .

Why MyBatis?

There are many Java-based persistence frameworks, however MyBatis became popular because of the following reasons:

• It Eliminates a lot of JDBC boilerplate code

• It has a low learning curve

• It works well with legacy databases

• It embraces SQL

• It provides support for integration with Spring and Guice frameworks

• It provides support for integration with third-party cache libraries

• It induces better performance

--

--