Spring Data JPA -Criteria Queries - The Full Guide

Поділитися
Вставка
  • Опубліковано 6 вер 2024

КОМЕНТАРІ • 95

  • @BoualiAli
    @BoualiAli  Рік тому +1

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

  • @yashkevich
    @yashkevich 11 місяців тому +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

  • @spring8355
    @spring8355 Рік тому +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  Рік тому

      You can check the exception handling video

  • @supun_sandaruwan
    @supun_sandaruwan 7 місяців тому

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

    • @BoualiAli
      @BoualiAli  4 місяці тому

      Glad you liked it!

  • @4wrk
    @4wrk 4 місяці тому

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

  • @elkhanismayilov
    @elkhanismayilov Місяць тому

    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???

  • @kyrylochornobryvets3385
    @kyrylochornobryvets3385 Місяць тому

    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. 👍

  • @pqan112
    @pqan112 Рік тому +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  Рік тому

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

    • @pqan112
      @pqan112 Рік тому

      @@BoualiAli Thank you so much teacher

  • @attabou100
    @attabou100 Рік тому

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

  • @mayureshkumar3717
    @mayureshkumar3717 2 місяці тому

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

  • @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

  • @soumikdash2866
    @soumikdash2866 2 місяці тому

    Thank you very much sir really appreciate your effort.

  • @hoangkim6246
    @hoangkim6246 10 місяців тому +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

  • @fatemehsalem3850
    @fatemehsalem3850 9 місяців тому

    Thank you for providing this tutorial, it is so unique

    • @BoualiAli
      @BoualiAli  9 місяців тому

      Happy you liked it!

  • @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

  • @Teze-m8b
    @Teze-m8b 2 місяці тому

    Excellent tutorial

  • @Utub-qc2cz
    @Utub-qc2cz 7 місяців тому

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

  • @ahmedabdoz
    @ahmedabdoz 10 місяців тому +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  9 місяців тому

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

  • @imranmomin4571
    @imranmomin4571 7 місяців тому

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

  • @manojv2893
    @manojv2893 5 місяців тому

    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?

  • @rihabbensoula1016
    @rihabbensoula1016 Рік тому +1

    Great job ,keep going

  • @daoookhanhuyenn
    @daoookhanhuyenn 3 місяці тому

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

  • @atefjlassi193
    @atefjlassi193 Рік тому

    Great, Thank you Bouali

  • @geethikathota9063
    @geethikathota9063 Рік тому

    Very helpful. Thank you so much.

  • @ShrivastavaMohit07
    @ShrivastavaMohit07 Рік тому

    Great explanation

  • @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

  • @toufiklaggoune5972
    @toufiklaggoune5972 Рік тому

    Always the best. Keep going bro.

  • @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

  • @ruff7209
    @ruff7209 Рік тому

    Nice tutorial, thx man!

  • @mouhamedbasse6311
    @mouhamedbasse6311 Рік тому +1

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

  • @attabou100
    @attabou100 Рік тому

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

    • @BoualiAli
      @BoualiAli  Рік тому +1

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

  • @ankukoul07
    @ankukoul07 Рік тому

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

  • @nailiridha7179
    @nailiridha7179 Рік тому

    tres bien bravo

  • @AnvarbekTurdaliyev
    @AnvarbekTurdaliyev Рік тому

    thank you very much

  • @samarthkamble7270
    @samarthkamble7270 Рік тому

    Thanks a lot man❤

  • @saiprasanthmattupalli4611
    @saiprasanthmattupalli4611 Рік тому +1

    How do we join multiple tables in criteria query ?

    • @BoualiAli
      @BoualiAli  Рік тому +1

      I will make a video on that soon

  • @luwamabraham4338
    @luwamabraham4338 Рік тому

    Thank You

  • @attabou100
    @attabou100 Рік тому

    Thanks a lot

  • @GianfrancoTerrazzano
    @GianfrancoTerrazzano 11 місяців тому

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

    • @BoualiAli
      @BoualiAli  11 місяців тому +1

      In the description

  • @niladrisekharnath
    @niladrisekharnath Рік тому

    I have a question why use Predicate[0] ?

    • @BoualiAli
      @BoualiAli  Рік тому

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

  • @gokulvarshan1114
    @gokulvarshan1114 11 місяців тому

    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  11 місяців тому

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

    • @gokulvarshan1114
      @gokulvarshan1114 11 місяців тому

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

  • @mona9741
    @mona9741 5 місяців тому

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

  • @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

  • @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

  • @elkhanismayilov
    @elkhanismayilov Рік тому

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

    • @BoualiAli
      @BoualiAli  Рік тому +1

      Will add it in the next video

  • @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

  • @piseyheng2564
    @piseyheng2564 Рік тому

    Could you provide source code link please?

    • @BoualiAli
      @BoualiAli  Рік тому

      I will try to find it and update the description

  • @sefumies
    @sefumies 18 годин тому

    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  16 годин тому

      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.