Difference between Hibernate and MyBatis

Posted by itungnt on Thursday, January 21, 2016

Hibernate and MyBatis both are Object Relational Mapping (ORM) frameworks which allow us to access relational databases from object-oriented languages. But what is the difference between them. In my opinion, the most difference is the control over SQL.

  • Hibernate allow you to CRUD using object entity
  • MyBatis should be used for fetching data using complicated SQL
  1. Hibernate Example

Pojo Class

Mapping Configuration File

How to Use

  1. MyBatis Example

The mapper interface definition

The definition of BlogMapper.xml

How to use


comments powered by Disqus