MyBatis vs JPA

AdvantageWeakness
MyBatis1. Simple Separate Soure code and SQL
2. Directly write SQL query
1. Repeat code and CRUD SQL operations.
2.Dependencies on SQL and Database vendors
JPA1. The developer does not have to write SQL for CRUD.
– Using Spring Data JPA, Query can be implemented only with an interface declaration
2. Additional deletion of maintenance columns does not require modification of all related CRUD Query.
– You only need to modify the entity managed by the JPA.
3. Database vendors use different data types or SQL JPA for easy resolution.
– Mostly unrelated to the RDBMS type.
** Object-oriented behavior means less effort to change grammar when using other vendor databases, such as Oracle and MySQL.
4. Develop object-oriented development from SQL-centric development.
1. JPA is more optimized for real-time processing than for complex queries such as statistical processing.
MyBatis vs JPA

What is MyBatis?

MyBatis is a first class persistence framework with support for custom SQL, stored procedures and advanced mappings. MyBatis eliminates almost all of the JDBC code and manual setting of parameters and retrieval of results. MyBatis can use simple XML or Annotations for configuration and map primitives, Map interfaces and Java POJOs (Plain Old Java Objects) to database records.

This is SQL Mapper. MyBatis do not follow JPA standard.

What is JPA?

The Java ORM standard for storing, accessing, and managing Java objects in a relational database

This is ORM

(Map database objects as Java objects to automatically create SQL based on relationships between objects.

The representative implementer of JPA is Hibernate. These implementations are called ORM Framework.

more information

The worldwide trend is using JPA a lot of JPA a lot.

Spring Data JPA

  • Repository Abstracts can be implemented only with an interface declaration.
  • Query generation by method name.

Spring Data JPA is not a JPA provider. It is a library/framework that adds an extra layer of abstraction on the top of our JPA provider (like Hibernate).

Leave a Reply

Your email address will not be published.

ANOTE.DEV