I am new to JPA.
As per my understanding, JPA is specification and Hibernate implements JPA and provide add on features along with JPA methods.
But I was going through JPA tutorials, where using EntityManager
object we can perform CRUD on data, without using Hibernate libraries!
So can anyone please let me know
EntityManager
methods, not using Hibernate?Please mention some useful link or example.
Much appreciate response.
Thanks.
Hibernate provides a reference implementation of the Java Persistence API that makes it a great choice as an ORM tool with the benefits of loose coupling. Remember, Spring Data JPA always requires the JPA provider such as Hibernate or Eclipse Link.
Java Persistence API (JPA) defines the management of relational data in the Java applications. Hibernate is an Object-Relational Mapping (ORM) tool which is used to save the state of Java object into the database. It is just a specification. Various ORM tools implement it for data persistence.
This is the type of code Spring Data JPA helps to avoid. Spring Data JPA is really a set of dependencies that makes it easier to work with a JPA provider. Hibernate is one of several JPA providers. This means you can use Spring Data JPA without using Hibernate (if you really wanted to).
You cant actually use both of them in the same application.
You are right JPA is a specification. Hibernate, and EclipseLink are a couple of its implementations.
You have to specify the persistence provider(Hibernate, EclipseLink) in order to use the JPA implementation. The persistence providers have the implementation classes for JPA specifications.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With