Spring Boot | JPA / Hibernate Composite Primary Key Example | JavaTechie

Поделиться
HTML-код
  • Опубликовано: 12 янв 2025

Комментарии • 61

  • @anilmaurya55
    @anilmaurya55 3 года назад +5

    You are the only one great teacher on RUclips who gives proper explanation with example thanks

  • @anuragarora2960
    @anuragarora2960 Год назад +1

    One in very few channels on RUclips who provide good industry level knowledge in technology after learning from here one can easily work in industry level projects

    • @Javatechie
      @Javatechie  Год назад +1

      Thanks buddy keep learning 😃

  • @deeplife9654
    @deeplife9654 8 месяцев назад

    Super nice ❤. Short and crispy. No too much talking but on the point.

  • @TalhaAnsari-y5i
    @TalhaAnsari-y5i 3 года назад +1

    Excellent Sir I have learn lots concept your video and also implement my project. Thank You Sir

  • @prajapati-parmod
    @prajapati-parmod 6 месяцев назад

    Thanks, Java Techie.
    got a clear picture in a short time.

  • @Farm2Code
    @Farm2Code 2 месяца назад +1

    Hohh god was stuck at this from days

  • @mountinrose6722
    @mountinrose6722 4 года назад +1

    Thank you !! It's solve may problem in fews days. I am using @IdClass, before I used @EmbeddedId and it make me headaches.
    Great jobs Brother !!

  • @yuwaan2.0
    @yuwaan2.0 2 года назад +1

    Good explanation

  • @vaishnavinaik1559
    @vaishnavinaik1559 Год назад +1

    Very explained !! But what I have observed is even though I have updated primary key from one column to composite key with 2 columns in DB it is working fine in spring boot application without changing entity class. Entity class is still using old PK as @Id.

    • @Javatechie
      @Javatechie  Год назад

      Yes it will allow as we haven't created constraints in db

  • @lyriobatanga6303
    @lyriobatanga6303 3 года назад +1

    Thanks a lot. You saved my day!

  • @perumalsamygiri2645
    @perumalsamygiri2645 Год назад +1

    Very nice sir

  • @deepakmarneni2110
    @deepakmarneni2110 4 года назад +5

    Thank you. nice. could you please make a video on one to one, many to one, many to many, and all CASCADE types with examples.

    • @Javatechie
      @Javatechie  4 года назад +1

      Hi Deepak it's already there please cross verify once

  • @raghuvardhansaripalli9636
    @raghuvardhansaripalli9636 4 года назад

    Thanks Bro. You ate awesome..keep it up..God Bless You..😊

  • @pratishrutipanda6461
    @pratishrutipanda6461 4 года назад +1

    Nice video sir

  • @nsphaniraj345
    @nsphaniraj345 4 года назад +3

    Nice. It will be helpful if you create another video which explains Composite key with one to many relationship between parent and child tables.

  • @surajbaranwal56.
    @surajbaranwal56. Год назад +1

    Helpful thanks men

  • @learningjavawithme915
    @learningjavawithme915 3 года назад +1

    You are excellent

  • @venkychannel2798
    @venkychannel2798 4 года назад

    Good stuff .. keep on update..

  • @varshapardeshi4779
    @varshapardeshi4779 Год назад +1

    Thank You.. Do you have any video on shared primary key for springboot jpa?

    • @Javatechie
      @Javatechie  Год назад

      Please check my association mapping videos

  • @subhashreesahoo5760
    @subhashreesahoo5760 2 года назад

    is it possible to get findby one pair , nd delete and update operation possible?

  • @goku6272
    @goku6272 3 года назад

    As we know there should be one primary key in table, if one using composite primary key(@EmbeddedId) can i use @Id also

  • @akshaydubey.57.a75
    @akshaydubey.57.a75 10 дней назад

    wht if i hava 2 tabled emp and user, and composite empid+userid

  • @vrijilk8532
    @vrijilk8532 4 года назад +1

    Is it possible for auto entity generation based on sql schema instead of manual creation?? Like Asp.net Entity Framework?

    • @Javatechie
      @Javatechie  4 года назад +1

      Virij in mybatis there is an option but am not much aware about this

    • @vrijilk8532
      @vrijilk8532 4 года назад

      @@Javatechie can we try? That is much better .

  • @umamaheswarreddy9204
    @umamaheswarreddy9204 4 года назад

    Very nice

  • @shaileshsingh5664
    @shaileshsingh5664 4 года назад

    Much needed tutorial since old hibernate wasn't able to support composite key
    Now it supports.
    Hi sir need to store spatial and JSON data from hibernate.
    Can you please make a tutorial.
    And cucumber tutorial with spring Boot.

    • @Javatechie
      @Javatechie  4 года назад

      Cucumber tutorial is already uploaded please search in javatechie

  • @bollywood90ssongs65
    @bollywood90ssongs65 2 года назад +1

    can you please make video on how to use Employee and Department as @OnetoMany relationship with composite key that will help us more.

    • @Javatechie
      @Javatechie  2 года назад +1

      You can checkout my one to many video using jpa

  • @jorgevalverde9064
    @jorgevalverde9064 2 года назад +1

    Nice, thanks!!!

  • @srikanthchowdary8595
    @srikanthchowdary8595 3 года назад +1

    Hai bro great explanation can you also explain why we need to override the equals nd hashcode method of compositeId class ?

    • @angajam
      @angajam 2 года назад

      HahCode and equals method will used internally for equality of entities. If two entities with same hashCode and equals are inserted then hibernate will allow only one using equals and hashCode.

  • @vaibhavasrivastava3957
    @vaibhavasrivastava3957 Год назад +1

    how will findByID or deleteById work in this case??

    • @Javatechie
      @Javatechie  Год назад

      Even though we declared composite key still we have 1 pk right? Using that we can play

  • @puneetsaneja3007
    @puneetsaneja3007 3 года назад

    Hi. Which approach is preferable. @Idclass or @embeddable ?

  • @sureshmaheshuni372
    @sureshmaheshuni372 4 года назад

    Can you do the playlist on java 8 features

  • @abhishekgupta7675
    @abhishekgupta7675 2 года назад +1

    ankur bhaiya ke ads still annoy the same.

    • @Javatechie
      @Javatechie  2 года назад

      Brother as I mentioned earlier to you.add decided by RUclips algorithm. I don't have any option to choose add by myself 😜

  • @pravinchavan7147
    @pravinchavan7147 3 года назад +1

    how can we use @generatedvalue for employeeId?

    • @Javatechie
      @Javatechie  3 года назад

      It won't work for no SQL you need to create custom approach please check already I explained how you can do same using mongo DB

  • @luckytheracer4557
    @luckytheracer4557 Год назад

    sir i actually do not understand the need of composite key. Cant it get solved with table normalization. Where is the real usecase still confuse

  • @prajyotlawande193
    @prajyotlawande193 3 года назад +2

    You gotta be really careful with Lombok there. @Data already includes @EqualsAndHashCode. Hence using @Data on Employee entity will lead to inclusion of all the Employee fields in its equals and hashcode methods, which I don't quite think will be correct.🙄

  • @vinodkumarsahu7726
    @vinodkumarsahu7726 3 года назад

    How to update with composite key?

  • @Cosmicwaves9909
    @Cosmicwaves9909 4 года назад

    Please make one to one, one to many, many to many using composite primary key in jpa

    • @Javatechie
      @Javatechie  4 года назад

      Okay Many to Many I will try

  • @krishnasaic
    @krishnasaic 2 года назад +1

    How to use findById() here where i want to particularly search by one of the Pkey where it can return list of entities associated with that id.

    • @Javatechie
      @Javatechie  2 года назад

      No you should search with composite key

    • @krishnasaic
      @krishnasaic 2 года назад

      @@Javatechie Then should i go for custom query?? If i want to search by specific pKey

    • @krishnamohan5771
      @krishnamohan5771 Год назад

      in those we have to go by @idClass approach@@krishnasaic

  • @juancamilogonzalezdiaz3135
    @juancamilogonzalezdiaz3135 4 месяца назад

    Thank You So Much! I tried it with @Embeddable and @EmbeddableId but didn't work, maybe you know why?. By the way: little donation next month ✌

  • @Raj-hm6qi
    @Raj-hm6qi 4 года назад

    Nice video sir