2

Can we use spring data JPA to perform all the database operations? Can we perform all the complex things like caching, stored procedures etc. using spring data JPA and use spring data JPA in place of hibernate?

All the examples I've come across have only been using spring data JPA with spring boot.

2 Answers 2

7

Spring data is not intend to replace hibernate.

The purpose of spring data is to simplify or remove the DAO layer implementations entirely.

Hibernate implement the JPA specification, but not spring data. Also spring data can use hibernate as an implementation of JPA specification.

Sign up to request clarification or add additional context in comments.

Comments

3

Spring data that is named in other answer is something different. It's an umbrella that spans project intended to access databases in some way. Those are spring-data-jpa, spring-data-jdbc...

Spring-data-jpa is spring's component that eases the usage of jpa by, for example, providing JpaRepository interface, where you can define methods without implementation, that will be implemented in runtime using their names. This way you can manage your persistent layer without writing a single line of SQL.

Under the hood spring-data-jpa uses some jpa implementation. By default it's hibernate, but it can be changed to openJPA, toplink and others.

2 Comments

As you said, spring-data-jpa is hibernate by default, that means everything which can be done using hibernate can be done using spring-data-jpa alone as well?
I didn't say those are the same, I said spring-data-jpa uses hibernate. So yes, you can use hibernate's functionality

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.