Compare the difference between JPA and Hibernate and Mybatis

  1. A brief understanding of JPA, Hibernate, Mybatis
    1. JPA: itself is an ORM specification, not an ORM framework. Implementation is provided by major ORM frameworks.
    2. Hibernate: The most popular ORM framework at present, with smart design and rich documentation (fully automatic operation), but the performance is not well controlled (you control the performance yourself, not very well).

Hibernate is a complete ORM framework, we don't need to write a sentence of SQL for conventional CRUD;

3.MyBatis: This is an open source project iBatis of Apache, and the persistence layer framework provided includes SQL Maps and Dao, allowing developers to write SQL directly (better and flexible). (Sql operation mode)

MyBatis is not a complete ORM framework, because we still need to write all SQL ourselves

2. The difference between JPA and Hibernate and Mybatis

JPA: Specification, major ORM frameworks implement this specification. Can automatically build tables.

Hibernate: It is a complete ORM, does not require us to write sql, the framework is heavier, the learning cost is relatively high, the performance is not well controlled, the function is powerful and the documentation is rich.

Mybatis: Not a complete ORM, programmers need to write all SQL by themselves, lightweight framework, low learning cost, good performance control. The table cannot be created automatically.

ORM operation database relational mapping:

1. Through the configuration file, map the domain to the table in the database, and map the domain member variable to the column in the table.

Guess you like

Origin blog.csdn.net/qq_41076577/article/details/108551846