Lalit
Lalit

Reputation: 23

Using spring data JPA instead of hibernate

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.

Upvotes: 2

Views: 3140

Answers (2)

Andronicus
Andronicus

Reputation: 26026

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.

Upvotes: 3

Andrianekena Moise
Andrianekena Moise

Reputation: 1068

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.

Upvotes: 7

Related Questions