Skip to content

Instantly share code, notes, and snippets.

@ledangtuanbk
Created August 23, 2019 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ledangtuanbk/48a12798be06e80b7154d67148d301a2 to your computer and use it in GitHub Desktop.
Save ledangtuanbk/48a12798be06e80b7154d67148d301a2 to your computer and use it in GitHub Desktop.
1. JPA Java Persistence API provides a specification for persisting, reading and managing data from your java object to relational tables in database
2. Hibernate is an object ralational mapping solution for java enviroments. ORM is a programming technique to map application domain model objects to relational database tables;
Hibernate provides a reference implementation of Java Persistence API that make it a greate choice as ORM tools with benefit of loose coupling.
Note that JPA is a specification and Hibernate is a JPA provider of implementation.
3. Spring Data is a part of the Spring Framework. The goal of Spring Data repository abstraction is reduce amount of
boilerplate code requited to implement data access layer.
Spring Data is not a JPA provider. It's a library/framework that adds an extra layer of abstraction on the top of our JPA provider (like Hibernate).
Difference between Hibernate and Spring Data.
- Hibernate is a JPA implementation, while Spring Data JPA is a JPA Data Access Abstraction.
Spring data offers a solution to GenericDao custom implementations. It can also generate JPA query on your behalf
through method name conventions. With Spring Data, you may use Hibernate, Eclipse Link, or any other JPA provider.
A very interesting is that you can control transation boundaries declaratively using the @Transactional annotation.
- Spring JPA is not and implementation or JPA provider, it's just an abstraction used to reduce boilderplate code
required to implement data access layers for various persistance stores.
- Hibernate provides a reference implementation of the JAVA Persistance API that makes a greate choice as an ORM tool
with benefits of loose coupling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment