Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rameshmf/spring-data-jpa-tutorial

Guide to spring data jpa
https://github.com/rameshmf/spring-data-jpa-tutorial

jpa spring-boot spring-data-jpa spring-framework

Last synced: 3 months ago
JSON representation

Guide to spring data jpa

Awesome Lists containing this project

README

        











  • Spring Data JPA Tutorial - Getting Started - This article provides a quick introduction to Spring Data JPA. It also describes all the important interfaces of Spring data commons and Spring Data JPA - Repository, CrudRepository, PagingAndSortingRepository, QueryDslPredicateExecutor, JpaRepository, JpaSpecificationExecutor




  • Spring Data JPA - Query Creation from Method Names - In this article, we will learn how we can create query methods by using the query generation from the method name strategy. We will demonstrate this with a complete end-to-end example using Spring boot.







  • Spring Data JPA - Auditing with Spring Boot 2 and MySQL Example - In this article, we will discuss how can we configure JPA to automatically persist the CreatedBy, CreatedDate, LastModifiedBy, and LastModifiedDate columns for any entity. We will create a simple Spring Boot CRUD REST APIs and we implement auditing using spring data JPA.




  • Spring Data JPA - Working with Multiple Datasources using Spring Boot -  In this article, we will learn how to configure multiple data sources and connect to multiple databases in a typical Spring Boot web application. We will use Spring Boot, JPA, Hibernate 5, Thymeleaf and H2 database to build a simple Spring Boot multiple data sources web application.





  • Spring Data Java 8 Support - Spring Data now supports core Java 8 features – such as Optional, Stream API and CompletableFuture. In this quick article, we’ll go through some examples of how we can use these with the framework.




  • Spring Data Annotations - In this tutorial, we’ll see the most common annotations of the Spring Data, Spring Data JPA, and Spring Data MongoDB projects.




Basic Spring Data JPA Flow




Once you completed reading above all articles then let's understand basic flow at the time of accessing the database using Spring Data JPA is shown below.












Sr.No.Description



(1)




Call the method of Repository interface from Service.


Entity object, Entity ID etc. are passed as method calling parameters. In the above example, the entity is passed, however, a primitive value can also be passed.



(2)




A proxy class which dynamically implements Repository interface delegates the process to org.springframework.data.jpa.repository.support.SimpleJpaRepository or custom Repository class.


Parameters specified by Service are passed.



(3)




Repository implementation class calls JPA APIs.


The parameters specified by Service and the parameters generated by the implementation class of the Repository are passed.



(4)




Hibernate JPA reference implementation calls the Hibernate core APIs.


The parameters specified by the implementation class of the Repository and the parameters generated by Hibernate JPA reference implementation are passed.



(5)




Hibernate Core API generates SQL and bind values from the specified parameters and passes to JDBC driver.


(API of java.sql.PreparedStatement is used for binding the actual values.)



(6)




JDBC driver executes SQL.



Useful Resources and Links


This section showcases useful material created by other developers. If you have written a blog post or recorded a video about Spring Data JPA, and want to include it to this section, do comment and I will check it out. If I think that it is useful, I will add it to this section.


Reference Manuals and Official Guides




Blog Posts/Articles





Top J2EE Tutorials