Spring Data JPA -Criteria Queries - The Full Guide

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ธ.ค. 2024

ความคิดเห็น •

  • @BoualiAli
    @BoualiAli  ปีที่แล้ว +1

    Join the Micro Services course waiting list and get and get an exclusive *EARLY-BIRD discount*
    aliboucoding.ck.page/d0f9317e13

  • @supun_sandaruwan
    @supun_sandaruwan 11 หลายเดือนก่อน +1

    I didn't even heard about criteria queries in spring boot. Thank you so much for sharing knowledge with us, Sir ❤🌻.

    • @BoualiAli
      @BoualiAli  8 หลายเดือนก่อน

      Glad you liked it!

  • @CoolBishop1997
    @CoolBishop1997 2 หลายเดือนก่อน

    Jazaka llaho khayran

  • @fatemehsalem3850
    @fatemehsalem3850 ปีที่แล้ว

    Thank you for providing this tutorial, it is so unique

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว

      Happy you liked it!

  • @4wrk
    @4wrk 7 หลายเดือนก่อน

    Thanks a lot! Your guide helped me to avoid creation of bunch of unnecessary methods within my repo layer :)

    • @BoualiAli
      @BoualiAli  7 หลายเดือนก่อน +1

      Glad it helped!

  • @toufiqulislamimran7911
    @toufiqulislamimran7911 ปีที่แล้ว

    Man you are a life saver, till this video I didn't know about this feature of JPA. Thanks a lot man.❤❤

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว +1

      Happy you liked it!
      You can also check the SPring Data JPA advanced course on my website aliboucoding.com/courses

    • @toufiqulislamimran7911
      @toufiqulislamimran7911 ปีที่แล้ว

      @@BoualiAli Thank you so much and Please make video on Unit testing

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว

      @@toufiqulislamimran7911 soon

  • @yashkevich
    @yashkevich ปีที่แล้ว +2

    In the first case, the request will look like: select * from employee where (last_name = LIKE '%:lastName%' OR first_name LIKE '%:firstName%') AND first_name LIKE '%:email%') That is, the OR predicates will be in parentheses (1 OR 2) AND 3, since they are in a separate predicate

  • @soumikdash2866
    @soumikdash2866 5 หลายเดือนก่อน

    Thank you very much sir really appreciate your effort.

  • @attabou100
    @attabou100 2 ปีที่แล้ว

    Exactly ; I repeated the video , and you explained very well when criteria is used ; thnaks a lot dear Teacher

    • @BoualiAli
      @BoualiAli  2 ปีที่แล้ว

      My pleasure 😇

  • @geethikathota9063
    @geethikathota9063 ปีที่แล้ว

    Very helpful. Thank you so much.

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว

      Glad it was helpful!

  • @toufiklaggoune5972
    @toufiklaggoune5972 2 ปีที่แล้ว

    Always the best. Keep going bro.

    • @BoualiAli
      @BoualiAli  2 ปีที่แล้ว +1

      Thanks a lot.
      I will

  • @Teze-m8b
    @Teze-m8b 5 หลายเดือนก่อน

    Excellent tutorial

  • @rihabbensoula1016
    @rihabbensoula1016 2 ปีที่แล้ว +1

    Great job ,keep going

    • @BoualiAli
      @BoualiAli  2 ปีที่แล้ว

      Thank youuuuu

  • @atefjlassi193
    @atefjlassi193 2 ปีที่แล้ว

    Great, Thank you Bouali

  • @ruff7209
    @ruff7209 ปีที่แล้ว

    Nice tutorial, thx man!

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว

      Happy you enjoyed it

  • @spring8355
    @spring8355 2 ปีที่แล้ว +5

    Thank you for your kind explanation, keep going ❤❤❤.
    Please, I would like to know what is the best practice for handling exception :
    extending "Exception" or extending "RuntimeException"

    • @BoualiAli
      @BoualiAli  2 ปีที่แล้ว

      You can check the exception handling video

  • @ShrivastavaMohit07
    @ShrivastavaMohit07 ปีที่แล้ว

    Great explanation

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว

      Glad it was helpful!

  • @123cheke
    @123cheke หลายเดือนก่อน

    great video. Quick question, what about if email has underscore characters(_) ?

  • @pqan112
    @pqan112 2 ปีที่แล้ว +2

    Thanks so much teacher, I'm a newbie Springboot. I don't know how to create complete API with relationship between tables. Other tutorial videos just teach me how to create API based on an entity. I hope you can do a video about my problems, thanks

    • @BoualiAli
      @BoualiAli  2 ปีที่แล้ว

      Enjoy this
      aliboucoding.com/p/first-hands-on-spring-boot-framework

    • @pqan112
      @pqan112 2 ปีที่แล้ว

      @@BoualiAli Thank you so much teacher

  • @kyrylochornobryvets3385
    @kyrylochornobryvets3385 5 หลายเดือนก่อน

    Hmm. Full Guide without joins and join fetch?! But you gave good approach. Thanks. It will be great if you create really full guide for Criteria Queries with joins and fetch joins and some queries which we don't know. 👍

  • @samarthkamble7270
    @samarthkamble7270 ปีที่แล้ว

    Thanks a lot man❤

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว

      You're welcome!

  • @imranmomin4571
    @imranmomin4571 11 หลายเดือนก่อน

    @BoualiAli Can you make a video on search on multiple table using criteria query ?

  • @elkhanismayilov
    @elkhanismayilov 4 หลายเดือนก่อน

    Thank you for this tutorial but I have a question for that topic. How we can search to date range with criteria query. Would you explain or refer for me???

  • @codewithtee
    @codewithtee หลายเดือนก่อน

    How can make the list be a custom Response, e.g EmplyeeResponseDto and also how do I query relation of Employee (e.g depeartment)

  • @AnvarbekTurdaliyev
    @AnvarbekTurdaliyev ปีที่แล้ว

    thank you very much

  • @Utub-qc2cz
    @Utub-qc2cz 10 หลายเดือนก่อน

    Question: Is there anyway to access Join tables using criteria API ?

  • @smb6311
    @smb6311 2 ปีที่แล้ว +1

    Merci beaucoup pour le tuto Sensei! ça aurait été encore plus plus cool illustré avec un pageable.

  • @larsmichael6242
    @larsmichael6242 ปีที่แล้ว +2

    Nice video. Just having some trouble with querying nested objects in my entities. I'm using the @Embedded / @Embeddable annotations, but am not quite sure how to format the json data in my request body so that Spring understands.

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว

      Can you share more details?
      Maybe in our discord server, sharing will be easier and get faster feedback

  • @arturszmer3336
    @arturszmer3336 ปีที่แล้ว

    Hey! Your tutorials are great but please do something with sound on introduction :) Just take mikrofon closer to you, if you want to hide your microfon you could place them under the view but close to you. Another way is bring more staff to you room to make reverb much smaller ;) If you need any advice about sound you can let me know.

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว

      Thank you so much for the nice feedback.
      I upgraded my setup for better quality.
      Yes I would like to discuss more with you.please reach out on discord

  • @nailiridha7179
    @nailiridha7179 2 ปีที่แล้ว

    tres bien bravo

  • @hoangkim6246
    @hoangkim6246 ปีที่แล้ว +1

    Thank you for your video. Can you tell me how to join multiple tables where the returned result list is a collection of attributes from those tables.I'm sorry that my English is very bad. I hope you will understand

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว

      User Projection

  • @daoookhanhuyenn
    @daoookhanhuyenn 7 หลายเดือนก่อน

    If I want to join a table in Criteria, how should I do it?

  • @manojv2893
    @manojv2893 9 หลายเดือนก่อน

    This syntax doesn't work with Hibernate 6 as we cannot use the same predicate more then once. Can you please re-record for Hibernate 6?

  • @luwamabraham4338
    @luwamabraham4338 ปีที่แล้ว

    Thank You

  • @saiprasanthmattupalli4611
    @saiprasanthmattupalli4611 2 ปีที่แล้ว +1

    How do we join multiple tables in criteria query ?

    • @BoualiAli
      @BoualiAli  2 ปีที่แล้ว +1

      I will make a video on that soon

  • @ankukoul07
    @ankukoul07 ปีที่แล้ว

    Nice..What if there are multiple filter conditions like for 20 fields..?

  • @attabou100
    @attabou100 2 ปีที่แล้ว

    Thanks a lot

  • @mayureshkumar3717
    @mayureshkumar3717 6 หลายเดือนก่อน

    didn't understood the last part of using toArray and passing it to the or method

  • @ngavv7095
    @ngavv7095 ปีที่แล้ว

    what spring-data-jpa-pro-class whait project in github want to do,it's about easier using JPA?Looking forward your answer,thacher

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว

      This is the spring data jpa pro class course coming really soon.
      Join aliboucoding.com and you receive an email when the course is released

    • @ngavv7095
      @ngavv7095 ปีที่แล้ว

      @@BoualiAli tks

  • @gokulvarshan1114
    @gokulvarshan1114 ปีที่แล้ว

    can you help me with a problem please...
    i Need to filter a single string of a id from the list of string of id which is inthe database using this method you said can u tell me please

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว

      Can you give an example?
      I didn’t get what you mean

    • @gokulvarshan1114
      @gokulvarshan1114 ปีที่แล้ว

      @@BoualiAli how to search a single string in list of string

  • @ahmedabdoz
    @ahmedabdoz ปีที่แล้ว +1

    I am sorry but you said we are using that to avoid using if/else ,in the second example it ends up doing this , you have an if check for every search criteria

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว

      there is a difference between if..else to compose a query and if..else for null check

  • @GianfrancoTerrazzano
    @GianfrancoTerrazzano ปีที่แล้ว

    Hi! Thanks for the tutorial, it was great. There is a github where I can find the source code?

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว +1

      In the description

  • @norulshahlamjohn1140
    @norulshahlamjohn1140 ปีที่แล้ว

    i believe this all can be greatly simplified by using Derived Query Methods in Spring Data JPA Repositories right sir?

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว

      It is possible but you will need to write a complex query for it to handle all the fields.
      Criteria query is more flexible in that direction

  • @niladrisekharnath
    @niladrisekharnath ปีที่แล้ว

    I have a question why use Predicate[0] ?

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว

      Foo[] array = list.toArray(new Foo[0]);

  • @rohan1618
    @rohan1618 ปีที่แล้ว

    Do you have junit for this code?

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว

      Unfortunately not

    • @rohan1618
      @rohan1618 ปีที่แล้ว

      @@BoualiAli how to write junit for this any book anywhere

  • @mona9741
    @mona9741 9 หลายเดือนก่อน

    do you have the code for this project in github, cause I can't find it
    ps: great vid

    • @BoualiAli
      @BoualiAli  8 หลายเดือนก่อน

      Sorry, no

  • @elkhanismayilov
    @elkhanismayilov ปีที่แล้ว

    why yo doesn't suggest us dynamic query like any repo @Query ?

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว +1

      Will add it in the next video

  • @attabou100
    @attabou100 2 ปีที่แล้ว

    In your opinion, is there an advantage of always using "Criteria Queries" despite it being too long and complicated ?

    • @BoualiAli
      @BoualiAli  2 ปีที่แล้ว +1

      Always, I would say no
      I already explained the use case of criteria queries

  • @muhendis_
    @muhendis_ ปีที่แล้ว

    there are lots of thing what ı dont know. I have to learn these descriptions 🙁

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว

      Yes, the learning path is quite long but nothing is impossible

  • @piseyheng2564
    @piseyheng2564 ปีที่แล้ว

    Could you provide source code link please?

    • @BoualiAli
      @BoualiAli  ปีที่แล้ว

      I will try to find it and update the description

  • @stefumies
    @stefumies 3 หลายเดือนก่อน

    Quite a bit of information here, yet very disappointing that you are choosing to become far more involved than the last lessons. If you are choosing to show the more advanced areas of JPA I think more specific explanations are required. There is far too much for a beginner to consume, and you merely are instructing watchers to follow along with what you do, but failing to educate them on the what and why.
    For me, criteria queries are a rather less-than-basic-feature of JPA and, in this current example, highly unnecessary and over complicate things substantially. It almost feels as if you have skipped several more introductory lessons to JPA queries and started right in at the deep end.
    You do some great material, but many of your lessons are rather to off the flow for beginners. For me, I think most of your content is fantastic, even as an old and seasoned developer I always get something out of them,. but I feel here you have lost direction somewhat.

    • @BoualiAli
      @BoualiAli  3 หลายเดือนก่อน

      Hi,
      Thank you for the feedback.
      All the answers for your questions are in the spring data jpa complete lesson.
      It is better to enable the notifications to get all the recent videos.