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

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

Eliminates a lot of JDBC boilerplate code

Java has a Java DataBase Connectivity (JDBC) API to work with relational databases. But JDBC is a very low-level API, and we need to write a lot of code to perform database operations.

Let us examine how we can implement simple insert and select operations on a STUDENTS table using plain JDBC.

Assume ...

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