Spring Boot | Dynamic Inserts & Updates With Spring Data JPA | JavaTechie

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ต.ค. 2022
  • In this tutorial, we will learn how to use @DynamicInsert & @DynamicUpdate annotation in spring data JPA and their purpose of using in real time app
    @DynamicInsert annotation ensures that Hibernate uses only the given columns in the SQL statement that it generates for the create of an entity.
    @DynamicUpdate annotation ensures that Hibernate uses only the modified columns in the SQL statement that it generates for the update of an entity.
    Spring boot microservice Live course Just started (Recordings available)
    Hurry-up & Register today itself!
    COURSE LINK : javatechie5246.ongraphy.com/
    PROMO CODE : Java40
    Spring Batch video link : • IQ | Spring Batch for ...
    GitHub:
    github.com/Java-Techie-jt/dyn...
    Blogs:
    / javatechie
    Facebook:
    / javatechie
    guys if you like this video please do subscribe now and press the bell icon to not miss any update from Java Techie
    Disclaimer/Policy:
    --------------------------------
    Note : All uploaded content in this channel is mine and its not copied from any community ,
    you are free to use source code from above mentioned GitHub account
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @mohitsharma9553
    @mohitsharma9553 ปีที่แล้ว +8

    Really good stuff for enterprise level projects. Please continue posting such videos to get industry level knowledge.

  • @MrAchilles2
    @MrAchilles2 ปีที่แล้ว +4

    Basant !!!
    you are awesome man
    thank you for keeping us enriched with new topics

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

    Thank you for the useful knowledge related to JPA. Didn't have any idea these annotations existed.

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

    I stumbled upon this channel while checking feignclient implementations.
    Later I went through some 2-3 videos and found those very useful(then I immediately subscribed 😂). Thanks for to the point and neat explanations. Please post more videos on performance improvements it helps us a lot.

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

    Thank You So Much Basant sir, it will surely increase my application performance... please bring more more topics like this...

  • @soundarraghavan3962
    @soundarraghavan3962 21 วันที่ผ่านมา +1

    Basant I am your big fan ❤ Everytime When I plan to switch company, your videos are only my mentor. So far I switched 4 companies. Now I'm in good package. Thank you so much for everything ❤️

    • @Javatechie
      @Javatechie  21 วันที่ผ่านมา

      Hello Raghavan , I am so happy to hear this keep learning buddy 😊 and congratulations 🎊 👏

    • @soundarraghavan3962
      @soundarraghavan3962 21 วันที่ผ่านมา +1

      @@Javatechie ❤️💕

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

    Completely new and api performance optimization feature..very good elaboration. Thank you👍👍👍

  • @nagendra.t
    @nagendra.t ปีที่แล้ว +1

    Thanks basant ,now I will implement this in my project. Thanks for sharing your knowledge 🙂.

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

    Thanks for the information. Pls continue post such useful videos.

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

    Wonderful Explanation

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

    This is really helpful! Thank you.

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

    You make such amazing video JavaTechie, I have no enough words to praise 🙂.. 💯

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

    As always a well thought out content 👍

  • @AshishYadav-se4db
    @AshishYadav-se4db ปีที่แล้ว +1

    As always a well thought out content 👍🙏🙏

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

    Really good content appreciate it. The way you explain is really good

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

    Excellent 👌

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

    Amazing 👍

  • @medAmineRg
    @medAmineRg 8 หลายเดือนก่อน +1

    great stuff thanks

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

    This ia very good video. Example and content was very to the point.

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

    Useful content

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

    Nice concept

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

    💯 Really helpful Thanks

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

    Thanks for giving me an updated one.

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

    Please bring out more similar topics about jpa and springboot performance. 🤩
    Thank you for this one Basant. ✌️🙂

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

      Sure Ashish 🙂

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

      @@Javatechie basant if posible simple login with oauth2,0 custom auth server example please ..with database client id and secret

  • @PraveenKumar-oc3mg
    @PraveenKumar-oc3mg ปีที่แล้ว +1

    Thank you 😍😍

  • @nabinkhatiwada4597
    @nabinkhatiwada4597 ปีที่แล้ว +6

    Thank you. In update operation, When i was using model mapper to convert DTO to DB object, fields like created date time becomes null by default since not present in DTO. For update, i don't need to reinitialize those fields now. Thanks

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

    You are legend sir

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

    Damn I was looking for this last week.. just one annotation helps

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

    Thanks

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

    Thanks 😊

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

    Thank you

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

    It will be good if you can show how performance is improved in time

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

    cool.

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

    Thank you as always, this is really great, and a very powerful yet simple way for performance improvement. Is there any downside to it as I wonder why it is not included by default?

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

      As i mentioned hibernate load default insert and update query by considering all the attributes of your entity.this way every time hibernate will reuse the same query to increase it's internal performance of using query but it will impact on application performance

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

    Good job, Java Techie all videos are really helpful.
    by the way what is owner name?😀

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

      Thanks buddy which owner?

  • @AnkitPandey-tl9vu
    @AnkitPandey-tl9vu ปีที่แล้ว +1

    good stuff ! but If you're updating or inserting a large number of entities, the extra overhead of generating dynamic SQL statements at runtime could impact performance right ?

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

      Yes that's correct

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

    Please make video on n+1 problem..it is being asked in many interviews

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

    Good content, you can perform login with oauth2.0 and save it to id in database thank

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

    basant if posible simple login with oauth2,0 custom auth server example please ..with database client id and secret

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

    Thank you, i think this is impossible with jpa, so i do native query all the time lol. How about dynamic select and join? jpa always select more fields than i need

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

      For select and join will check and update you

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

    Good morning Basant, can these two annotations(@DynamicInsert and @DynamicUpdate) replace PATCH HTTP Method?

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

      No these annotations will just optimise the query

  • @TechSpy
    @TechSpy ปีที่แล้ว +3

    Hi Basant bhai,
    Need tutorial on JPA Criteria Query and Specifications.
    Please, it would be very helpful for everyone.

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

      Okay we will do that

    • @user-og7de8ih4f
      @user-og7de8ih4f ปีที่แล้ว +2

      @@Javatechie yes please

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

      Lmao, my company uses that criteria and specification for dB queries.
      It saves you a lot of stress of writing multiple routes for specific searches.

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

    For dynamic update you gave name and price in request body in post man but query showed only price column.
    Is it because the new name and existing name are same?

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

      Yes correct. @DynamicUpdate is smart enough to scan it .

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

      @@Javatechie Thank You very much

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

    Kindly make the tutorial about multiple database connection in spring boot best practices

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

      It's already there please check with multiple data source in spring boot

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

    Hi! how can i reach you? any email id? facing issues creating SSO

  • @lts8683
    @lts8683 ปีที่แล้ว +3

    Excellent
    Can you talk about n+1 hibernate problem

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

      Yes i will it's in my queue

    • @ManishSingh-uo1lb
      @ManishSingh-uo1lb ปีที่แล้ว

      checkout vlad's blog he have explained it

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

    How do I display values in the insert statement?

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

    Hi Bro,
    Create video on Debugging.
    I joined as experienced person but I'm facing some issue while debugging.. please create a video on Debugging,so it will all of us..

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

    Will these 2 annotations works fine with only save() ? What about saveAll() ?

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

      These 2 for insert and update operation

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

      If we use saveAll() to save a bunch of records, ain't these annotations work??

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

      Yes it will work

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

      Thank You So Much Basant Bhai.... Jay Jagannath 🙏

  • @Pqrstuvwxyz-w9o
    @Pqrstuvwxyz-w9o ปีที่แล้ว +1

    Crud using dto can u explain plss

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

      It doesn't matter whether you used dto or not entity will save to db

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

    What if name is same for other record?

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

      Not getting you can you elaborate bit

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

      If we are not passing id in update, how will it differentiate with other records. If id 1 and 3 have same book name it will be update both the records correct

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

    Hi can you do a video on spring boot and GraalVM

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

      Yes i will do that

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

      @@Javatechie Thankyou for your reply and all your videos 🥹🥹🥹

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

    Oauth2.0 custom auth server example need no using Keyclock

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

      Not using keyclock but i will create custom auth server

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

      @@Javatechie yes thanks..if posible please do login page in angular as well it will provide clarity..

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

    What is the validity of microservices live course?

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

      Currently it's for 1 yr . I request the team to extend this limit

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

      @@Javatechie is it one year from enrollment date?

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

      @@udhayasankar113 yes

    • @RaviYadav-cx2pb
      @RaviYadav-cx2pb ปีที่แล้ว

      How to enrolled it?

    • @RaviYadav-cx2pb
      @RaviYadav-cx2pb ปีที่แล้ว

      @@Javatechie how to enrolled it?

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

    At this point it is easier to use jooq and have full control over database then trying to hack and learn bs details about JPA.

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

    Basant bhai tamar kou college bput ra?

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

    please use dark theme on future videos, the white hurt my eyes :(

  • @Tout-Le-Monde02
    @Tout-Le-Monde02 ปีที่แล้ว +1

    14:14 why are you sending all the other fields in your json request body, if you intend to only update the description field? That's why hibernate is generating update script for all the fields ...... and forcibly passing null as a json field value is not at all a good design principle ..... just don't include those fields in the json ...... weird logic ......

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

      If you won't pass those values then null will be updated in DB

    • @Tout-Le-Monde02
      @Tout-Le-Monde02 ปีที่แล้ว

      @@Javatechie No it doesn't.

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

      Please try once

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

    Everything is ok but 100 columns in table is too bad design to have. Ideally should not be referred to as an example.

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

      Just an example buddy 😊. We can keep more than 15 columns right 👍

    • @sudheerkumar-tp1mg
      @sudheerkumar-tp1mg ปีที่แล้ว

      100 columns are minimum in employee table

    • @sudheerkumar-tp1mg
      @sudheerkumar-tp1mg ปีที่แล้ว

      100 columns are minimum in employee table

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

    This is a bad video because you didn't explain that using the dynamic annotations has a performance cost. In most cases it's better Performance to leave it out, it's only good when your entity has a large amount of fields that are large in length

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

    @DynamicUpdate or @DynamicInsert has a performance overhead associated with it. Don't forget on it

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

      How buddy?

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

      @@Javatechie Hibernate does not use the cached SQL statement for Dynamic Update or Insert which means every statement is generated and not pulled from the cache

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

      @@matusseidl yes if hibernate will use cached SQL statement then in single value update will trigger update for all the attribute/columns present in your entity right? This will eat a lot of time as well as memory

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

      ​ @Java Techie maybe, it could be good video compare those scenarios. And yes if you have entity with many fields (columns) 20-30 and you just update one of them and that update isn't executing often I could use DynamicUpdate.

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

    Hi Bro,
    Create video on Debugging.
    I joined as experienced person but I'm facing some issue while debugging.. please create a video on Debugging,so it will all of us..

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

    Hi Bro,
    Create video on Debugging.
    I joined as experienced person but I'm facing some issue while debugging.. please create a video on Debugging,so it will all of us..