How do JPA, Hibernate, JdbcTemplate and MyBatis differ? When do you pick each?
Short answer
JPA is a specification (annotations, EntityManager), Hibernate is a library that implements it, and Spring Data JPA adds repositories on top. JdbcTemplate and MyBatis let you write the SQL yourself.
3 points to say:
- JPA is the spec, Hibernate the implementation.
- JdbcTemplate and MyBatis give full control over SQL.
- With an ORM you still must read the SQL it generates.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.