Now how do you add pagination to other methods besides the findall method? For example I am using a Spring data JPA query called "List findByBusinessAccountInfo(BusinessAccountInfo businessAccountInfo);" But this does not support Pageable
@@CodeJava Thanks for the quick reply! I have another question.. So I got everything done and I was able to get the Page using this method. However on another webpage I am having trouble getting the Page List when I use stream API. I am making a DAO call and using stream api with Collectors.toList which is returning me a List. I am unable to cast that to a page.. therefor I am not able to get a page reference doing this. Is there something else other then collectors.toList that will return me a page instead? I tried looking but can not find it
This is from the DAO Page findByBusinessAccountInfo(BusinessAccountInfo businessAccountInfo, Pageable pageable); This is when I call it.. Page page = chairRecordSL.findByBusinessAccountInfo(user.getBusinessAccountInfo(), pageable).stream().filter(x -> x.getChairNumber() == chairNumber).collect(Collectors.toList()); The issue is Collectors.toList returns a list and not a page. I tried Type casting it to a page but it would not let me. I can return it as a list but then I wont get the page reference..
Có cách nào số trang hiển thị giảm bớt đi không anh, ví dụ lấy lên dữ liệu cho 8 trang mà chúng ta chỉ muốn hiển thị 4 trang 1,2,3,4, khi ở trang 4 click vô next thì hiển thị trang 2,3,4,5. Rất vui nếu được anh reply comment. Em like video trước ^-^
Code Java I don’t know whether it’s called convention method or not. But let’s assume you will find an employee from a list by searching his name. In Thymeleaf how would you take the input and pass it to the controller class in order to fetch specific user details.
very good example mister Code Java, congratulations. But if the page had more records it would show like this [First Previous 1 2 3 4 5 6 ... Next Last], It would be good if only the first three or four are shown, not all, so it would not show as many numbers [First Previous .. 3 4 5 6 .. Next Last], how would you do that master.
Then the logic would be quite simple: in the for each loop, check value of the counter variable i like this: 4 < i < totalPages - 4 and show the links only if i satisfies that condition. Or you can use two for loop: the first count from 1 to 4, and the second counts from totalPages - 4 to totalPages.
@@CodeJava Master Code Java I was testing according to your indications but I was not successful, you could do it in your same example, please. If you were so nice, thanks. :/
Dear Nam, Could you please add me to your github repo of the course "Spring Boot E-Commerce Ultimate Course"? I asked you on Udemy but still heard from you
@@CodeJava Em đang học FresherAcademy tại FPT anh ạ, khóa học của em xong rồi, hiện tại người ở đơn vị đang xuống phỏng vấn , nếu qua thì sẽ nhận vào đơn vị làm việc ạ.
@Code Java Master Code Java I was testing according to your indications but I was not successful, you could do it in your same example, please. If you were so nice, thanks. :/
You can find the source code and sample project in this text-based tutorial: www.codejava.net/frameworks/spring-boot/spring-data-jpa-paging-and-sorting-examples
The @Param annotation is used in repository interfaces, and the @RequestParam is used in controllers (it's optional). It's my mistake of using @Param in controller.
Link to copy code examples and download sample project: www.codejava.net/frameworks/spring-boot/spring-data-jpa-paging-and-sorting-examples
The best spring boot tutorial channel in youtube
Thanks. Check out the full Spring Boot playlist: th-cam.com/video/B4IDlfT-53I/w-d-xo.html
@@CodeJava your code is very crystal clear ... Superb....
You are the Spring Boot DUDE 🖖🏻🖖🏻🖖🏻🖖🏻🖖🏻🖖🏻🖖🏻🖖🏻🖖🏻🖖🏻🖖🏻🖖🏻🖖🏻
Greetings from my desktop :) Thanks for watching.
Cảm ơn anh đã chia sẻ kiến thức tới mọi người. Chúc anh sức khỏe, thành công! ^_^
ko có gì em. Cảm ơn em :)
@@nguyenbakhoi8157 em đọc bài viết này: www.codejava.net/frameworks/spring-boot/spring-data-jpa-paging-and-sorting-examples
Amazing Resource, I love the way you explain very in detail. Your tutorial help me get through my days. Thank you😀😀😀😀😀😀
Glad I could help!
I understood d pagination Very well..Thank u
You're most welcome
This exersice is very very cool, thanks a lot !!!!
You're welcome!
Sorting: 45:30
Hey Dear thanks helpful video and nice explanation . Now I got to know pagination concept
Glad to hear that
You are awesome, bro. YOU are my FRIEND.
Wow, thanks. Kindly share with video with your friends and colleagues.
Very well explained !!
Glad it was helpful! Kindly subscribe.
Thanks. Well explained. Could you share your insight why css is only applied on index and not appearing on pages ?
Sorry, I don't understand your question. Could you explain?
Now how do you add pagination to other methods besides the findall method? For example I am using a Spring data JPA query called
"List findByBusinessAccountInfo(BusinessAccountInfo businessAccountInfo);"
But this does not support Pageable
Simply add Pageable as the second parameter to that method.
@@CodeJava Thanks for the quick reply! I have another question.. So I got everything done and I was able to get the Page using this method.
However on another webpage I am having trouble getting the Page List when I use stream API. I am making a DAO call and using stream api with Collectors.toList which is returning me a List. I am unable to cast that to a page.. therefor I am not able to get a page reference doing this.
Is there something else other then collectors.toList that will return me a page instead? I tried looking but can not find it
@@MrCupcakes85 show me your DAO code
This is from the DAO
Page findByBusinessAccountInfo(BusinessAccountInfo businessAccountInfo, Pageable pageable);
This is when I call it..
Page page = chairRecordSL.findByBusinessAccountInfo(user.getBusinessAccountInfo(), pageable).stream().filter(x -> x.getChairNumber() == chairNumber).collect(Collectors.toList());
The issue is Collectors.toList returns a list and not a page. I tried Type casting it to a page but it would not let me.
I can return it as a list but then I wont get the page reference..
Can you please cover complex queries or stored procedure execution with the REST web services?
Hmm, kindly give me some time to think about that.
Dạ cám ơn anh đã chỉ, tại em không dùng th:href = " @{ /css/style.css } " nên bị lỗi :P
very good and nice Mr. thank you so much but how to do this operating with BOOTSTRAP???(for instance pagination process)
kindly check this video: th-cam.com/video/_67pXB1JHTo/w-d-xo.html
Thanks. You saved my day.
Glad I could help!
can i use only jdbc for paging?
Sure, but it's not easy and quick as using Spring Data JPA.
awesome, you´re a genius!
Wow, thanks!
Sir can I apply that html code in to JSP page
No, because Thymeleaf is used for the view layer instead of JSP.
Có cách nào số trang hiển thị giảm bớt đi không anh, ví dụ lấy lên dữ liệu cho 8 trang mà chúng ta chỉ muốn hiển thị 4 trang 1,2,3,4, khi ở trang 4 click vô next thì hiển thị trang 2,3,4,5. Rất vui nếu được anh reply comment. Em like video trước ^-^
em xem video này nhé: th-cam.com/video/_67pXB1JHTo/w-d-xo.html
@@CodeJava thực sự hữu ích, cảm ơn a đã rep cmt của e, cũng như những video hữu ích. Hi vọng a sẽ tiếp tục ra nhiều video hơn nữa!
@@vantainguyen1549 cảm ơn em đã động viên anh :)
You're great. You deserve more views.
Thanks a lot.
Can you please make a video in findUser by username using Thymeleaf please?
You're welcome. So do you mean convention methods in Spring Data JPA?
Code Java I don’t know whether it’s called convention method or not. But let’s assume you will find an employee from a list by searching his name. In Thymeleaf how would you take the input and pass it to the controller class in order to fetch specific user details.
Hmm, I think it's something like search/filter function described greatly in this video: th-cam.com/video/Q4e_GydUjbs/w-d-xo.html
very good example mister Code Java, congratulations.
But if the page had more records it would show like this [First Previous 1 2 3 4 5 6 ... Next Last],
It would be good if only the first three or four are shown, not all, so it would not show as many numbers
[First Previous .. 3 4 5 6 .. Next Last], how would you do that master.
Then the logic would be quite simple: in the for each loop, check value of the counter variable i like this: 4 < i < totalPages - 4 and show the links only if i satisfies that condition.
Or you can use two for loop: the first count from 1 to 4, and the second counts from totalPages - 4 to totalPages.
@@CodeJava Master Code Java I was testing according to your indications but I was not successful, you could do it in your same example, please. If you were so nice, thanks. :/
@@CodeJava Can you please tell me where to use that Loop , In Thymeleaf or Controller. Can you please implement that logic.
@@Restyle23 you should implement that logic in Thymeleaf. I will publish a video about this thing, okay?
@@CodeJava Yes , please. Thanks.
Sir th:each= i:${#numbers.sequence(1,totalpages)}
Without thymleaf kaise karnge
spring security course available?
No, I don't have a separate course for Spring Security. I have this one: www.udemy.com/course/spring-boot-e-commerce-ultimate
@@CodeJava thanks
i
@@CodeJava Hi one more junit tutorial available?
Dear Nam, Could you please add me to your github repo of the course "Spring Boot E-Commerce Ultimate Course"? I asked you on Udemy but still heard from you
Oh, I thought I replied you. What's your GitHub username?
like video nhưng mà a có video về search pagination không
here is it: th-cam.com/video/Q4e_GydUjbs/w-d-xo.html
@@CodeJava tks so much ♥
Hello Brother Why error PageRequest
you need to import it from the right package: org.springframework.data.domain
Thank you very much, can you post it on github pls ?
Yes, soon
Thanks a lot for your tutorials
👌
NAM please make videos on charts and graphs its my humble request
I noted, man.
chào anh muốn làm cái show Entries thì phải làm sao Anh
em giải thích rõ hơn được ko?
@@CodeJava là mình muốn thêm cái lengthMenu á Anh[ [5,10,25,50,-1],[5,10,20,50,"All"] á Anh
@@CodeJava hiện cái show để kích vô 5 là record xổ dưới hay 10 .. đồ á Anh
anh hiểu rồi. Anh sẽ làm một video hướng dẫn.
Em cám ơn anh, vừa bị audit về phân trang bằng JPA mà ko trả lời được, xem video của anh xong bây giờ thì ko lo bị hỏi về pagging bằng JPA nữa rồi
Great. Em đang làm lập trình ở đâu?
@@CodeJava Em đang học FresherAcademy tại FPT anh ạ, khóa học của em xong rồi, hiện tại người ở đơn vị đang xuống phỏng vấn , nếu qua thì sẽ nhận vào đơn vị làm việc ạ.
@@ducdatnguyen9251 good luck!
@Code Java Master Code Java I was testing according to your indications but I was not successful, you could do it in your same example, please. If you were so nice, thanks. :/
What error did you get? What did it behave?
em cảm ơn anh về video ko bt Anh có thể cho em xin source code đc ko anh
link: www.codejava.net/frameworks/spring-boot/spring-data-jpa-paging-and-sorting-examples
Nice.. can you please share source code? it will help me....
You can find the source code and sample project in this text-based tutorial: www.codejava.net/frameworks/spring-boot/spring-data-jpa-paging-and-sorting-examples
can you tell me the difference between @RequestParam and @Param, why you use @Param and not @RequestParam
The @Param annotation is used in repository interfaces, and the @RequestParam is used in controllers (it's optional). It's my mistake of using @Param in controller.
@@CodeJava Thanks for your answer
please share code
you can find code in this tutorial: www.codejava.net/frameworks/spring-boot/spring-data-jpa-paging-and-sorting-examples