The difference between Mybatis and Hibernate
1. The SQL statements in Hibernate have been encapsulated and can be used directly, while Mybatis is semi-automated. SQL needs to be completed manually;
2. Hibernate is a complete object-relational mapping framework, while Mybatis needs to manage the mapping relationship by itself.
#3. Hibernate automatically generates SQL. Some statements are more cumbersome and will consume more performance. Manually writing SQL in Mybatis can avoid unnecessary queries and improve system performance;
Hibernate
Hibernate is an open source object-relational mapping framework that encapsulates JDBC with very lightweight objects and establishes POJOs with database tables. The mapping relationship is a fully automatic ORM framework. Hibernate can automatically generate SQL statements and execute them automatically, allowing Java programmers to use object programming thinking to manipulate the database as they wish. Hibernate can be used in any situation where JDBC is used, either in Java client programs or in Servlet/JSP Web applications. The most revolutionary thing is that Hibernate can replace CMP in the JaveEE architecture that uses EJB. , complete the important task of data persistence.
Mybatis
MyBatis was originally an open source project iBatis of apache. In 2010, this project was migrated from apache software foundation to google code and renamed MyBatis. Migrated to Github in November 2013.
The word iBATIS comes from the combination of "internet" and "abatis" and is a persistence layer framework based on Java. The persistence layer framework provided by iBATIS includes SQL Maps and Data Access Objects (DAOs)
Currently, the latest version is MyBatis 3.5.4, which was released on February 4, 2020.
Recommended tutorial: "Java Tutorial"
The above is the detailed content of What is the difference between Mybatis and Hibernate?. For more information, please follow other related articles on the PHP Chinese website!