Java Spring Boot - JPA - Hibernate - H2 - Paging with Filtering and Sorting

  Рет қаралды 47,478

CodeForgeYT

CodeForgeYT

3 жыл бұрын

In this video we will learn how to implement paging, sorting and filtering for our entity using Criteria API. Our technological stack is Java Spring Boot, JPA, Hibernate and H2 database engine. We will deep dive into Criteria API so we will work with things like EntityManager, CriteriaBuilder and CriteriaQuery. We will learn how to create regular query to retrieve information about entity and also how to implement count query. Everything easly explained step by step.
You can source code here: github.com/codeforgeyt/jpa-pa...
Follow //CodefForgeYT on:
FB: / codeforgeyt
Twitter: / codeforgeyt
GitHub: github.com/codeforgeyt
Instagram: / codeforgeyt

Пікірлер: 56
@rohitverma8184
@rohitverma8184 Жыл бұрын
Thx bro love you videos
@regenschirm22
@regenschirm22 2 жыл бұрын
thank you so much, you helped me understand this theme
@CodeForgeYT
@CodeForgeYT 2 жыл бұрын
Glad I could help!
@charcequence
@charcequence 2 жыл бұрын
I solve my problem for 4min, thanks to video!
@CodeForgeYT
@CodeForgeYT 2 жыл бұрын
Glad it helped!
@abdelmajidtaybi5949
@abdelmajidtaybi5949 3 жыл бұрын
Thank you very much
@CodeForgeYT
@CodeForgeYT 3 жыл бұрын
You are welcome
@timmy8846
@timmy8846 2 жыл бұрын
Thanks
@mohamednoser
@mohamednoser 2 жыл бұрын
Thank You very much
@CodeForgeYT
@CodeForgeYT 2 жыл бұрын
You are welcome
@sukanyamondal8892
@sukanyamondal8892 3 жыл бұрын
great tutorial, can you make a video about joins and range (like date between?) your way of teaching is very easy to wrap our heads around
@CodeForgeYT
@CodeForgeYT 3 жыл бұрын
Hey! Glad you like it. You meanr join and date between using Criteria API? Keep coding!
@sukanyamondal8892
@sukanyamondal8892 3 жыл бұрын
@@CodeForgeYT yes exactly, it would be a nice addition to the next step to this.
@CodeForgeYT
@CodeForgeYT 3 жыл бұрын
@@sukanyamondal8892 Thanks for idea!
@mohamedalivip3390
@mohamedalivip3390 Жыл бұрын
Thank you very much Can you explain if i want to make query with joined table using criteria builder
@joaquinolmedovillodres2518
@joaquinolmedovillodres2518 2 жыл бұрын
Hello, thank you for the tutorial. I'm trying to add a Date to the predicate this way and it's not working, should be any difference?
@niladrisekharnath
@niladrisekharnath 9 ай бұрын
Hey thanks for this great video can you please provide a link of the video where we can get the swagger ui and work with our endpoints Like how to set it up and use that ?
@srinathselvam6512
@srinathselvam6512 Жыл бұрын
Hi, incase of custom count query based on multiple table joins.. how to get total count records for pagination?
@arsensargsyan774
@arsensargsyan774 2 жыл бұрын
Thanks , how use like.root.get("enumName") enum type from string parameter?
@Runnable19
@Runnable19 8 ай бұрын
Thanks for the work but I think this video needs to be updated because of this problem "Error Message: Already registered a copy: SqmBasicValuedSimplePath". I'm using java 21.
@kanismit5491
@kanismit5491 3 жыл бұрын
Hi , nice tutorial but what about joins ? for example i need to filter by fields that in other table
@CodeForgeYT
@CodeForgeYT 3 жыл бұрын
Hi! Thanks for feedback! I am not showing it because for people which are just getting started with Criteria API it is already hard enough, but yes it is possible to make joins. There is a special generic class called Join . Take a closer look on it. Keep coding!
@timmy8846
@timmy8846 2 жыл бұрын
Exactly I really this rn, have you been able to get a solution?
@nikitayakovlev394
@nikitayakovlev394 2 жыл бұрын
@@timmy8846 Hi, did you find a solution?
@falseys
@falseys 2 жыл бұрын
Nice Tutorial, Thank you! One question, In real time how do we pass two different objects EmployeeSearchCriteria and Employee Page to get mapping method in the controller, For Example when testing it in post man
@tomsheldonworld
@tomsheldonworld 2 жыл бұрын
you can pass as nested objects in json (use post or put method)
@TechOnScreen
@TechOnScreen 2 жыл бұрын
can you tell how to make this postman call ? any sample please.
@Khantia
@Khantia Жыл бұрын
Why aren't you using @Autowired tho? In the project I'm working on, the "regular" repository is already using this annotation (within the service... and the service is also autowired in the controller) and now I don't know how to adjust your code in order to make them both work together.
@user-ps7op6gc2t
@user-ps7op6gc2t Жыл бұрын
Because he used constructor injection
@artemryvkin6885
@artemryvkin6885 2 жыл бұрын
nice video, but it will be good to get more explanation about used objects and methods... Because most of the video - just retelling or spelling the code you write
@CodeForgeYT
@CodeForgeYT 2 жыл бұрын
You can read about each method by hitting ctrl + q
@rosssihovsk5950
@rosssihovsk5950 2 жыл бұрын
Hey, i saw in comments idea about filering information in range(date between). is it worth waiting for the video or have you changed your mind about making it?
@CodeForgeYT
@CodeForgeYT 2 жыл бұрын
Hey. Thanks for comment. I think it will be quicker to look for different source of information for this topic.
@rosssihovsk5950
@rosssihovsk5950 2 жыл бұрын
@@CodeForgeYT ok, thanks for the answer
@BlendSkMix
@BlendSkMix Жыл бұрын
If field has null values , how to make it return value zero?? Using criteria builder. In sql i know we use IFNULL(NULL,0)
@user-ku8qb1rn1g
@user-ku8qb1rn1g Жыл бұрын
variable.equals("null")? variable = 0 : { };
@pratikghotekar8664
@pratikghotekar8664 2 жыл бұрын
Hello , How we can use operators like ,! in as query params in the URL. How can i extract and use in the criteria builder
@CodeForgeYT
@CodeForgeYT 2 жыл бұрын
Well you can use whatever you want. For example lets say we have ?sortOrder=asc. We cane use this in for example if statement to check if order direction should be ascending or descending
@pratikghotekar8664
@pratikghotekar8664 2 жыл бұрын
@@CodeForgeYT thanks for reply. ?firstName=abc&Age>20 I can retrieve firstName directly but how can i retrive Age?
@CodeForgeYT
@CodeForgeYT 2 жыл бұрын
@@pratikghotekar8664 You can do something like: ?age.gt=20 or ?age[gt]=20 then you have to parse such key to know how to check the value. There is a lot of different approaches.
@averagedev7768
@averagedev7768 2 жыл бұрын
Could we just use Pagable interface from spring boot itseflf
@CodeForgeYT
@CodeForgeYT 2 жыл бұрын
Hi, of course you can. I have an video about this topic on my channel. You can check it out. Using Criteria API you have more control over SQL queries so you can optimize them to increase performance in complex scenarios. Kee coding
@WaqarAhmad-ik9dt
@WaqarAhmad-ik9dt Жыл бұрын
Thank you so much, How we can filter with nested objects product { title; Detail detail; } Detail { description; }
@user-ku8qb1rn1g
@user-ku8qb1rn1g Жыл бұрын
Did you find the answer? I also encountered the same!
@sunnyisonvacation
@sunnyisonvacation 3 жыл бұрын
nice . But im unable to find github code for this tutorial ?
@CodeForgeYT
@CodeForgeYT 3 жыл бұрын
Hey! Thanks for feedback! I have uploaded source code to github. You can find link in video description. Happy coding! :D
@BabaykaMoscow
@BabaykaMoscow 2 жыл бұрын
Is it possible to sort by multiple fields?
@CodeForgeYT
@CodeForgeYT 2 жыл бұрын
If you will pass multiple arguments to orderBy method, I think it will order by multiple fields
@BabaykaMoscow
@BabaykaMoscow 2 жыл бұрын
@@CodeForgeYT Will check that out. Thank you!
@arhim7650
@arhim7650 2 жыл бұрын
Nice, but i don't like solution, when you need to go over two time in DB, scond it's when you get pageCount.
@CodeForgeYT
@CodeForgeYT 2 жыл бұрын
Hey! Thanks for feedback! Keep coding!
@karlrussellmenil9460
@karlrussellmenil9460 3 жыл бұрын
Topic: Full stack javascript - Data Pagination and Filtering Good day, If I may humbly ask a little help, any hints, comments and suggestions are very much welcome, thank you in advance for all your help, please see question below, how do I code this?: /* Create the `showPage` function This function will create and insert/append the elements needed to display a "page" of nine students */ /* Create the `addPagination` function This function will create and insert/append the elements needed for the pagination buttons */ // Call functions
@CodeForgeYT
@CodeForgeYT 3 жыл бұрын
Hey! Regarding your topic I understand it this way. I assume it should be MVC app, so you want to create student model, student view and student controller. Your controller will return student view together with the list of the students. Also this list should be filterable and pageable. But it is only my assumption, It would be the best to ask author
@CodeForgeYT
@CodeForgeYT 3 жыл бұрын
Please don't post code or links in the comments. Comments section is used to discuss video/channel related stuff and share thoughts about it. If you are looking for advice regarding your code you can share it for example on stackoverflow it is way better place than comments sections. Keep Coding!
@karlrussellmenil9460
@karlrussellmenil9460 3 жыл бұрын
@@CodeForgeYT deleted as per your request :)
@jespinala
@jespinala 7 ай бұрын
Thanks for this great video! I have followed it carefully and I am getting this error when this is executed: rbillingCriteriaQuery.from(Rbilling.class) org.springframework.dao.InvalidDataAccessApiUsageException: Not an entity: class itk.dbaccounting.rbilling.Rbilling; nested exception is java.lang.IllegalArgumentException: Not an entity: class itk.dbaccounting.rbilling.Rbilling Could you suggest anything about it?
Java Spring Boot - Lombok -  Installation and Annotations
11:32
CodeForgeYT
Рет қаралды 10 М.
Sigma Girl Past #funny #sigma #viral
00:20
CRAZY GREAPA
Рет қаралды 30 МЛН
Каха ограбил банк
01:00
К-Media
Рет қаралды 11 МЛН
Spring Data JPA Pagination
36:46
Dan Vega
Рет қаралды 18 М.
Pagination & Sorting in REST API using Spring Data JPA
12:01
Kris Foster
Рет қаралды 18 М.
Spring Data JPA from 0-100 in 60 minutes
1:02:31
VMware Tanzu
Рет қаралды 81 М.
Java REST API with Spring Boot Tutorial | REST API CRUD Implementation
36:27
Think Constructive
Рет қаралды 208 М.
Sigma Girl Past #funny #sigma #viral
00:20
CRAZY GREAPA
Рет қаралды 30 МЛН