can we use jpa without hibernate
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.
You can't just use JPA, cause it is an API =), but there are plenty JPA implementations:
- EclipseLink
- ObjectDB
Though this thread is pretty old, I felt it is worth breaking things down.
JPA: It Is just a specification. In simpler words. Set of interfaces.
Hibernate, Eclipse Link, Apache OpenJPA: A few of the many implementations of JPA. In addition to providing the basic implementations for the JPA specifications, Hibernate and other implementations provide their additional functionalities. You can choose based on your need
Spring Data:
- It provides additional abstraction.
- When you use Hibernate/Eclipse Link you still have to write some boilerplate code. By using Spring JPA you can avoid that.
- The most important thing to note is Spring data uses Hibernate by Default due to Springboot's Opinionated nature. You can change the default behavior if you would like.
- When you run the following command in a Springboot project that uses Spring JPA(with default configuration), you will see Hibernate jars being used.
Maven:
mvn dependency:tree
Gradle:
gradle dependencies
If you don't want to use Hibernate (or any other JPA provider), then you must implement your own provider, by giving an implementation for the javax.persistence.spi.PersistenceProvider interface. The question, is, why do you need re-invent the wheel ? If you don't like Hibernate, you can use one of the so many other JPA-Providers to choose from