JPA/Hibernate Fundamentals 2023 - Lesson 4 - Primary keys

Sdílet
Vložit
  • čas přidán 8. 09. 2024
  • Buy me a coffee ☕👉 buymeacoffee.c...
    In this stream, we discuss the JPA specification and learn to implement the persistence layer of a Java app using a JPA implementation such as Hibernate.

Komentáře • 28

  • @JalilHasanov
    @JalilHasanov Před 11 měsíci +6

    Laur your way of explanation is incredible, please make a cource on microservices

  • @Rajnish089
    @Rajnish089 Před rokem +7

    I wish I would get that much deep knowledge at my initial stage of my carrier

  • @mostafasaleh2806
    @mostafasaleh2806 Před rokem +3

    Amazing tutorial, Thank you

  • @laurspilca
    @laurspilca  Před rokem +5

    GitHub: github.com/lspil/youtubechannel/tree/master/jpa_2023_c4_e1

  • @kazbowski
    @kazbowski Před rokem +2

    Hey, thanks for your videos, ur the best!!!
    Can u record video about creating OAuth2 authorization server with dynamic RegisteredClient and JPA ? (When user can create a clients for authentication).
    Theme with OAuth2 in spring so hard and raw, we need more content about that!!!

  • @enestalha5718
    @enestalha5718 Před 5 měsíci +1

    Thank you so much for this course again. I like to watch and read everything you do, you are just great. I just want to ask you a question, I know that I am currently on the 4th video but do you refer to cache mechanism in next videos? If you don't, is there any chance you recommend a source to learn cache mechanism on hibernate or a specific technology widely used in applications?

    • @laurspilca
      @laurspilca  Před 5 měsíci

      Hmm.. No sure I know a specific book or video solely on caches :(

  • @aminpooja1230
    @aminpooja1230 Před 2 měsíci

    Hello from India. Sir, your videos are outstanding. I am a university professor and i teach students by simply going through your videos. I have read the first chapter of your book "Spring Start Here". Is there a way i can get a copy of that book? It will be really helpful for my subject. Thank you..

    • @laurspilca
      @laurspilca  Před 2 měsíci

      Hello. I think you can find it online the PDF version. I don't think the paper version is available in stores in India.

  • @user-dl5iw7nq4d
    @user-dl5iw7nq4d Před 5 měsíci

    Thanks laur, I felt composite keys little bit hard to get in JPA. But you put it simple. :)

  • @AliHassan-ty2me
    @AliHassan-ty2me Před 10 měsíci

    Thanks, as always :). Could you please make a video on Java Security/cryptography, which you use at 13:36, because I really don't understand what you did from that point onwards.

  • @CarlosLopez-ht1bu
    @CarlosLopez-ht1bu Před 6 měsíci

    Very good lesson, congratulations for such good content 😃. could you make videos about clean code in Java?

    • @laurspilca
      @laurspilca  Před 6 měsíci +1

      Sure. Thanks for your recommendation.

  • @holdenkarlhain96
    @holdenkarlhain96 Před 8 měsíci +1

    nice turtorial, I've also seen annotation SequenceGenerator above entity class, is that another way of using generator for primary key?

    • @laurspilca
      @laurspilca  Před 8 měsíci +1

      If I'm not wrong that is Hibernate specific and not inherited from JPA.

    • @holdenkarlhain96
      @holdenkarlhain96 Před 8 měsíci +1

      looked it up on the JPA documentation, as I understand it seems to be used when you want to use a sequence already declared on the db level.

    • @laurspilca
      @laurspilca  Před 8 měsíci +1

      @@holdenkarlhain96 I'm not sure I understand. All sequences are already declared at the DB level when you want to use them from a Java app. That is regardless of whether you use not a JPA implementation.

    • @holdenkarlhain96
      @holdenkarlhain96 Před 8 měsíci +1

      yeah I guess I meant when you create a sequence in a db script and then want to use that sequence by name for a primary key on your java entity.
      Im still learning JPA and definetly could have understood it incorrectly reading the documentation though.
      Anyhow thanks for this series you explain things very well and its been really helping me grasp these conspets. As Im just finishing my bachelors degree in cs and wanting to start working as a junior dev.

  • @Boyarsskiy
    @Boyarsskiy Před 10 měsíci +1

    Hello Laur! I was able to create a composite key without an external IdClass. Just placed two ID annotations above the fields. Why do you need to create an external class?
    I found only one advantage of the IdClass: you can put the Id annotation on only one field in the entity, but the key will still be composite, as described in IdClass.

    • @laurspilca
      @laurspilca  Před 10 měsíci +1

      Good question. I will check that. Maybe something changed in the last JPA version. I don't know. Usually having a class for the composite primary key was mandatory.

    • @Boyarsskiy
      @Boyarsskiy Před 10 měsíci

      Thank you! I just checked the latest JPA 3.1 specification: "The EmbeddedId or IdClass annotation is used to denote a composite primary key." Only two options, as you described.
      Perhaps in my case this is some undocumented feature. I'm using the latest hibernate-core 6.3.1.Final and the latest Postgres.

    • @laurspilca
      @laurspilca  Před 10 měsíci +1

      @@Boyarsskiy Wither that or it can happen sometimes some frameworks work differently. For example in Hibernate it might work but not in others. Best is if you stick to the specification in such a case.

    • @Boyarsskiy
      @Boyarsskiy Před 10 měsíci

      Completely agree

  • @Nevo1996
    @Nevo1996 Před 11 měsíci

    I have not seen yet the next videos from this playlist, but please Laur, put the sponge or how it is called, on the microphone to make your voice smoother and to cancel distortions. It's because you keep the microphone too close to the mouth, and it's hard to listen to you.

  • @jakhongirsabirov4891
    @jakhongirsabirov4891 Před 10 měsíci

    question if this jpa we will connect with real oracle db server which has more pakcets and more data tables with ddl-auto create. will it truncate whole schema with all
    table and packets ?

    • @laurspilca
      @laurspilca  Před 10 měsíci

      Hello. I am not sure this is a question or an observation. As I mentioned in the videos, ddl-create auto should only be used in examples. Never use it in real live apps. In real-world scenarios you can use Flyway or Liquibase to manage the scripts.