Тёмный

Spring Data JPA : JpaRepository vs CRUDRepository vs PagingAndSortingRepository 

TechTalk Debu
Подписаться 11 тыс.
Просмотров 17 тыс.
50% 1

#JpaRepository #CRUDRepository #PagingAndSortingRepository
► Difference between CrudRepository and JpaRepository and PagingAndSortingRepository interfaces in Spring Data JPA
► SUBSCRIBE & LIKE!!
► Official Email Id: techtalk.debu@gmail.com
► Download the sample java microservice application :
github.com/admindebu/In-Memor...
► Follow on Facebook: / techtalkdebu
► Follow on LinkedIn: / debu-paul
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
► Here is our amazing playlist for Core Java, Spring MVC/Boot, Git and Micro service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Core Java :: • Exception in Java deta...
2. Spring MVC & Spring Boot :: • Quick Start Spring Boo...
3. Micro Service :: • Micro Service - Monoli...
4. Git/GitHub :: • VCS - What is GitHub a...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Watch my "Most Watched Videos"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
► HTTPS & HTTPS protocol :: • What is HTTP Protocol ...
Playlist : • Core Java Interview Qu... Tutorial for beginners with examples, Interview Questions and Concepts.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Important Notes Related to Spring Data JPA Repository
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
► JpaRepository extends PagingAndSortingRepository which in turn extends CrudRepository.
Their main functions are:
• CrudRepository mainly provides CRUD functions.
• PagingAndSortingRepository provides methods to do pagination and sorting records.
• JpaRepository provides some JPA-related methods such as flushing the persistence context and deleting records in a batch.
Because of the inheritance mentioned above, JpaRepository will have all the functions of CrudRepository and PagingAndSortingRepository. So if you don't need the repository to have the functions provided by JpaRepository and PagingAndSortingRepository , use CrudRepository.
====================================
► CrudRepository - extends Repository
====================================
save(…) - save an Iterable of entities. Here, we can pass multiple objects to save them in a batch
saveAll(…) - Save all the entities
findById (…) - get a single entity based on passed primary key value
findAll() - get an Iterable of all available entities in database
findAllById(…) - get an Iterable of all available entities in database by matching criteria
count() - return the count of total entities in a table
delete(…) - delete an entity based on the passed object
deleteById(…) - delete an entity based on unique id value
deleteAll(…) - delete all entity from the table
existsById(…) - verify if an entity exists based on the passed primary key value
================================================
► PagingAndSortingRepository - extedns CrudRepository
================================================
In addition, CRUDRepository method below two additions are there
Iterable(T) findAll(Sort sort);
Page(T) findAll(Pageable pageable);
This interface provides a method findAll(Pageable pageable), which is the key to implementing Pagination
Example: I want to sort the record by name ascending order and each page should contain 10 records.
Sort sort = new Sort(new Sort.Order(Direction.ASC, "name"));
Pageable pageable = new PageRequest(0, 10, sort);
================================================
► JpaRepository - extends PagingAndSortingRepository
================================================
In addition, CRUDRepository method + PagingAndSortingRepository method + below methods
findOne (…) - get a single entity based on passed primary key value
flush() - flush all pending task to the database
saveAndFlush(…) - save the entity and flush changes immediately
deleteInBatch(…) - delete an Iterable of entities. Here, we can pass multiple objects to delete them in a batch
deleteAllInBatch() - delete all entities.
Regards,
Debu Paul

Наука

Опубликовано:

 

7 май 2020

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 41   
@naveenlalam
@naveenlalam Год назад
The way you explained the GrandFather, Parent and Child is amazing and crystal clear. Thank you for making such an amazing video
@TechTalkDebu
@TechTalkDebu Год назад
Thank you so much for your valuable inputs
@pratapjavasingh3239
@pratapjavasingh3239 4 года назад
Today I watched ur all the video related to the data jpa and Thnks great effort
@TechTalkDebu
@TechTalkDebu 4 года назад
Thank you 😊
@alfredochola5971
@alfredochola5971 Год назад
wow. u r a good teacher sir. thank u so much
@sri85100
@sri85100 3 года назад
Nice explanation, thanks its clear
@TechTalkDebu
@TechTalkDebu 3 года назад
Thank you so much
@Atul_Shegokar
@Atul_Shegokar 3 года назад
Thank you sir for this video and explained very nice way
@TechTalkDebu
@TechTalkDebu 3 года назад
Thank you so much for your valuable feedback .. you are most welcome
@ashishchamoli3326
@ashishchamoli3326 3 года назад
Thank you sir for this video.
@TechTalkDebu
@TechTalkDebu 3 года назад
Welcome 👍
@GMIqbalMahmud
@GMIqbalMahmud Год назад
Thank you for easy explanation.
@TechTalkDebu
@TechTalkDebu Год назад
Most welcome
@srikanth29
@srikanth29 4 года назад
Wow, thanks for this video
@TechTalkDebu
@TechTalkDebu 4 года назад
Thank you
@nareshch6454
@nareshch6454 2 года назад
Thank you brother good information
@TechTalkDebu
@TechTalkDebu 2 года назад
Thank you so much for your valuable feedback
@brajray2881
@brajray2881 3 года назад
Thanks you so much
@TechTalkDebu
@TechTalkDebu 3 года назад
Welcome
@jeevar7888
@jeevar7888 Год назад
Thanks 🎉
@TechTalkDebu
@TechTalkDebu Год назад
Welcome
@daumienebi
@daumienebi 2 года назад
Thanksss mannnn
@TechTalkDebu
@TechTalkDebu 2 года назад
Welcome and Thank you so much
@prakritiagrawal6846
@prakritiagrawal6846 4 года назад
Bahut sundar
@TechTalkDebu
@TechTalkDebu 4 года назад
Thank you
@dnyaneshtathode5511
@dnyaneshtathode5511 Год назад
Nice explanation!
@TechTalkDebu
@TechTalkDebu Год назад
Thank you
@mohangabhale5555
@mohangabhale5555 Год назад
Where can I get Hibernate jar files supportable for Ubuntu operating system
@TechTalkDebu
@TechTalkDebu Год назад
Maven central repository
@Srini8174
@Srini8174 3 года назад
Thank you
@TechTalkDebu
@TechTalkDebu 3 года назад
Welcome. For your valuable feedback
@mohangabhale5555
@mohangabhale5555 Год назад
i want to run Hibernate JPA with CURD project.. in eclipse that's why I need Hibernate jar files .. but I am using Linux OS i ..I want jar files supportable with eclipse & Ubuntu os
@TechTalkDebu
@TechTalkDebu Год назад
Okay... You can directly download the hibernate jar files from Maven central repository
@mekha123
@mekha123 4 года назад
Thanks For This Explain Can We Create Abstract Repository And Service For JPA Repository If It's Possible How Can We Used In Abstract Services
@TechTalkDebu
@TechTalkDebu 4 года назад
Thank you... I will make a video regarding this. For the time being you can take this baeldung reference : www.petrikainulainen.net/programming/spring-framework/spring-data-jpa-tutorial-adding-custom-methods-into-all-repositories/
@mekha123
@mekha123 4 года назад
@@TechTalkDebu Thanks so much i will wait
@TechTalkDebu
@TechTalkDebu 4 года назад
@@mekha123 sure
@sharmilasimhadri1604
@sharmilasimhadri1604 4 года назад
Good info provided thank i
@TechTalkDebu
@TechTalkDebu 4 года назад
Thank you
@bhupindersethi329
@bhupindersethi329 Год назад
Speak on Bengali instead 😅
@TechTalkDebu
@TechTalkDebu Год назад
Thanks for suggestions
Далее
What is JPA? | JPA Implementation
26:21
Просмотров 379 тыс.
Копия iPhone с WildBerries
1:00
Просмотров 2,8 млн
Что не так с камерой 200мп?
0:56
Просмотров 107 тыс.
#engineering #diy #amazing #electronic #fyp
0:59
Просмотров 1,8 млн