"Welcome To Ashok IT" "Spring Boot and MicroServices" Topic : Spring Data JPA Date : 02/10/2024 (Session - 37) _____________________________________________________________________________________________________________________________ Yesterday Session ================= * We completed understanding about Spring Data Module Importance and its advantages. Today Session ============= * Spring Data JPA is submodule of Spring Data Module. * By using Spring Data JPA we can work with any SQL Database Software (or) Relational Databases Software. Ex:oracle,mysql,postgresql,sqlserver etc., * While working with Spring Data JPA we can avoid writing boiler plate of Code of DAO logic/Persistence logic. Earlier development : ===================== 1.Entity Class 2.DAO/Repoistory Interface 3.DAO/Repoistory Implementation Class programmer need to define those abstract methods and provide the implementation of abstract methods. Spring Data JPA Development : ============================= 1.Entity Class 2.DAO/Repoistory Interface by extending Spring Data JPA provided Interfaces i.e.,CurdRepoistory,JpaRepoistory,PagingAndSortingRepoistory etc., Here Programmer no need to provide implementation class for DAO/Respoistory Interface automatically Spring Data JPA will internally generates dynamic Inmemory Proxy class in JVM Memory. * Spring Data JPA provided Repoistories contains ready made methods for commonly required database operations such as creating Record,Updating Record,Deleting Records,finding the records,finding record based on id etc., Respoistories in Spring data JPA ================================ * In the Spring Data JPA Module the Root Interface is "Respoistory(I)" is a Marker Interface which doesn't have any abstract methods and it will provide additional behaviour to Java Object java.lang.Cloneable,java.io.Serializable,org.springframework.data.Repoistory are marker interfaces and providing extra capabilities/Additional Behaviours to our Java Objects. * We have child interface for above Marker Interface of "Respoistory(I)" i.e., "CrudRepoistory(I)" which provides basic DAO operations i.e, 12 Methods Repoistory(I) <------------------> Parent Inteface ^ | extends | CrudRepository(I) <----------------> Child Interface(12 Methods) * We have another child interface for Repoistory interface i.e.,PagingAndSortingRepoistory(I) which provides Pagination feature and Sorting features. Repoistory(I) <------------------> Parent Inteface ^ | extends | PagingAndSortingRepoistory(I) <-----------> Child Inteface (2 Methods) * We have another child interface for CrudRepository interface i.e.,JpaRepoistory(I) which are getting services from another main two interfaces ListCrudRepository(I) and ListPagingAndSortingRepoistory * ListCrudRepository(I) is child interface of CrudRepoistory(I) the differences is ListCrudRepository gives results as List Object and CrudRepoistory gives results as Iterable object. * ListPagingAndSortingRepoistory(I) is child interface of PagingAndSortingRepoistory(I) the differences is ListPagingAndSortingRepoistory gives results as List Object and PagingAndSortingRepoistory gives results as Iterable object. NOTE ==== * During the Application Development our DAO Interfaces are extending from CrudRepoistory/PagingAndSortingRepoistory our interfaces will becomes auto discoverable means spring data jpa will create those objects automatically no need for defining @Repository stero type of annotation. interface CustomerDao extends CrudRepoistory{ } Below code is also valid but not recommended because we are already getting spring bean object from root interfaces i.e.,Repoistory(I) @Repoistory interface CustomerDao extends CrudRepoistory{ } * Make sure you need to complete atleast one relational database software in your machine oracle,mysql * Oracle11g Express Edition - https://sendfilebig.com/rdcLfKshdtOZJ8Y/file +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++