Spring Data JPA Interfaces

The following two tabs change content below.
Prasad Kharkar is a java enthusiast and always keen to explore and learn java technologies. He is SCJP,OCPWCD, OCEJPAD and aspires to be java architect.

Latest posts by Prasad Kharkar (see all)

This article will simply introduce spring data jpa interfaces. Here onwards, we are going to see JPA specific spring data implementation.

Spring Data JPA Interfaces:

In previous article we saw generic interfaces which abstract the functionality to provide repositories and common methods. Now, JPA is corresponding to relational databases. Spring data jpa interfaces have methods to save, find and update entities.

JPARepository

JPA specific extension of Repository.
As you can see that it extends PagingAndSortingRepository as well as QueryByExampleExecutor, it has methods from both interfaces.
This will be used for performing common CRUD operations.

JPASpecificationExecutor:

Interface to allow execution of Specifications based on the JPA criteria API.
It helps JPARepository implementation executions according to jpa criteria api for queries.

SimpleJPARepository:

Default implementation of the CrudRepository interface. This will offer you a more sophisticated interface than the plain EntityManager .

As you can note that this is a class i.e. implementation apart from sprint data jpa interfaces. It implements jpa specific interfaces to provide functionality. It gives a simpler interface than normal JPA EntityManager.
I hope this provides idea about spring data jpa interfaces, in next article, we will start with actual code.
Share Button

Leave a Reply

Your email address will not be published. Required fields are marked *