Spring Data JPA tutorial - Unboxing Spring Data JPA Magic | Spring Boot | JPA | MySQL | Hibernate

Поделиться
HTML-код
  • Опубликовано: 8 июн 2024
  • In this video, we will unbox the magic of spring data jpa. The Goal here is to understand how Spring Data JPA works internally.
    This spring data jpa tutorial will give a step-by-step walkthrough on
    1. Build a spring project
    2. Configuring Hibernate / JPA / Spring / MYSQL with our Java spring project.
    3. Doing CRUD operation with Spring Data JPA
    4. Once done, Converting the spring project to Spring Boot
    5. Explore spring data jpa with spring boot
    6. How spring data JPA works internally
    If you want to build a spring boot project that connects to a database, the first thing you will create is a data source.
    Datasource in Java holds the connection objects. We can use a DriverManagerDatasource in spring to create a datasource object.
    Once the Datasouce setup is done, we can create a EntityManager, which will help us with CRUD operation. EntityManager manages our entities (alternatively called persistence context) and provides a wide range of methods, like persist, remove, find, merge,findAll, etc. This will help us to save, delete, update, and query data from a database.
    To create an EnityManager, we can create an EntityManagerFactory first. We only can create an EntityManager from an EntityManagerFactory. In Spring, we need a LocalcontainerEntityManagerFactoryBean to initalize an entity manager factory.
    Once the LocalcontainerEntityManagerFactoryBean is set up, then it's time to set up a TransactionManager (PlatformTransactionManager). We can use the JpaTransactionManager to feed it the entity manager factory object to have a fully functional connection setup.
    In our DAO, We can use now use an EntityManager with a @PersistenceContext annotation. This will enable us to call the API methods to do CRUD operation.
    We can use a @Transactional Annotation on top of our API method to activate and begin/commit the transaction.
    Spring Data JPA enables us to automatic repository creation. With the @EnableJpaRepositories we no longer need to write repository classes and the basic CRUD methods to perform data manipulation.
    Spring Data JPA will do it all and allows us to have a fully functional CRUD Repository just by extending JpaRepository.
    When our custom repository interface extends JpaRepository, it inherits different methods from its super interfaces (CrudRepository, ListCrudRepository, Repository). These methods' implementation is generated in runtime by Spring. Spring Generates this implementation class by using JDK dynamic proxy / AOP proxy.
    Data Jpa configuration is so easy when it comes to Spring Boot. We have a one-stop solution to add all the dependencies. We can use a spring boot starter project called "spring boot starter data jpa," and it brings in all the different dependencies that we need to develop a JPA application with spring boot. For MySQL db, we can just add the MySQL driver, and we are ready to go.
    We may need to use @EntityScan and @EnableJpaRepositories to scan our Entities and Repository classes.
    Let's explore all these concepts in this video! Let's jump right in.
    Timestamp
    --------------
    Introduction - 00:00:00
    Build a Maven project - 00:05:34
    Building an Entity - 00:07:00
    JPA setup - jakarta.persistence-api - 00:08:48
    Setting up Repository and EntityManager - 00:13:50
    LocalContainerEntityManagerFactoryBean and DataSource setup- 00:23:36
    Introducing Hibernate - 00:47:56
    Uses of @PersistenceContext - 00:56:42
    @Transactional / TransactionManager setup - 01:02:27
    Introducing JpaTransactionManager - 01:06:00
    EntityManager persist method in action (save) - 01:13:00
    Introducing Spring Data JPA - 01:20:00
    findAll() implementation with JPA - 01:24:26
    Why Spring Data JPA: The Need - 01:29:51
    @EnableJpaRepository - 01:37:01
    Doing CRUD with Spring Data JPA - 01:38:20
    spring data jpa with spring boot - 01:46:19
    Spring Boot data jpa autoconfiguration - 01:53:07
    @EntityScan - 01:59:04
    What's inside the spring-boot-starter-data-jpa dependency?
    Activating show-sql in Spring / Spring boot app -02:05:34
    The End - 02:07:02
    #springdatajpa #springboot #jpa #hibernate
    For More free/paid courses visit
    www.seleniumexpress.com
    LINKS AND FREE LEARNING RESOURCES
    ========
    Watch my new mock interview series for java developers
    • Java interview questio...
    Watch Spring boot Hot topics
    • @Reposicotry Vs @Servi...
    Java Interview / Question and Answer series
    • Java collections inter...
    spring core
    • Spring framework tutor...
    spring mvc
    • Spring MVC course intr...
    spring mvc intermediate
    • [INTERMEDIATE] Spring ...
    For more courses visit
    www.seleniumexpress.com
    you can ask for support in my website forum
    www.seleniumexpress.com
    Subscribe to my youtube channel
    / @seleniumexpress
    Follow me on Insta
    / selenium_express

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

  • @SeleniumExpress
    @SeleniumExpress  11 месяцев назад +9

    Hi. There is a delay in uploading the next scheduled video on Spring Boot Foundation series.
    New video coming on this Wednesday. It will be a 10 hours crash course.
    Stay tuned to the below playlist for updates
    ruclips.net/video/F_rGkDeihBg/видео.html
    Have a good day !

  • @chintu4609
    @chintu4609 11 месяцев назад +10

    You are the first person on youtube that deliver this type of content. Hats off👏🙌

    • @SeleniumExpress
      @SeleniumExpress  11 месяцев назад

      Thank you for the kind words !! Hope it helps🥰

  • @Ramesh-re4eu
    @Ramesh-re4eu 11 месяцев назад +12

    I don't know why abhilash is sooo underrated.. hope you will get wat you deserve..❤❤

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

    First time saw such in depth analysis on jpa

  • @unemployedcse3514
    @unemployedcse3514 4 месяца назад +2

    Awesome vedio ❤, I don't think any book gives this much knowledge on Springboot, In single vedio I got know difference between spring and springboot,multiple data base configuration, etc ❤

  • @Mohamed-uf5jh
    @Mohamed-uf5jh 2 месяца назад

    Nice vidoe !
    First time saw such in depth analysis on jpa

  • @LeoLeo-nx5gi
    @LeoLeo-nx5gi 11 месяцев назад +4

    Thanks a ton!! This is very awesome and so much informative

  • @akashpisal3582
    @akashpisal3582 9 месяцев назад +1

    Fabulous tutorial, invaluable ...Thanks Abhilash

  • @chukwukaegbujio1450
    @chukwukaegbujio1450 7 месяцев назад

    This explanation is very clear

  • @joelchabzola8870
    @joelchabzola8870 11 месяцев назад +2

    Thanks for this series.

  • @eprohoda
    @eprohoda 11 месяцев назад +2

    Nice to meet you!so interesting shots!Selenium- 💫

  • @vino7tech
    @vino7tech 11 месяцев назад +1

    Thank you very much spring boot guru ji 🙏🙏🙏

  • @csrchandra8832
    @csrchandra8832 11 месяцев назад

    Vedio super information macha 🎉 it helps alot for all of us

  • @DurgaShiva7574
    @DurgaShiva7574 11 месяцев назад +2

    100th like by me, great job abhilash.

  • @shekhar1497
    @shekhar1497 3 месяца назад

    Thank you

  • @santhoshchandran6952
    @santhoshchandran6952 11 месяцев назад +2

    Thank you Abhi❤

  • @kalidsherefuddin
    @kalidsherefuddin 6 месяцев назад

    Thanks for

  • @user-xo1oj8vs7p
    @user-xo1oj8vs7p 7 месяцев назад

    Hi Selenium,
    One Request, Can you guide or make videos on one to one and other relationship, Where when and which scenario approach should follow to join the tables.

  • @akashpisal3582
    @akashpisal3582 9 месяцев назад +1

    Abhilash, Do you know how to map hibernate entity to postgres json column in Spring boot using data jpa..... also if possible w/o using any external library

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

    Hi is it possible to call a oracle function with output parameters using spring Data JPA?

  • @DeepakSharma-cv2tj
    @DeepakSharma-cv2tj 10 месяцев назад

    failed to configure a datasource: 'url' attribute is not specified and no embedded datasource could be configured. reason: failed to determine a suitable driver class action: consider the following: if you want an embedded database (h2, hsql or derby), please put it on the classpath. if you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

  • @RahulVerma-yl8bd
    @RahulVerma-yl8bd 4 месяца назад

    We want videos on hibernate mappings please🙏🙏

  • @dileepsimham9302
    @dileepsimham9302 11 месяцев назад

    sir, can you please make a video on oauth2.0

  • @kanchanshelke9992
    @kanchanshelke9992 11 месяцев назад

    sir, please make videos on spring boot. I have completed the full spring playlist. please upload ASAP SpringBoot playlist.

  • @user-me7jk9lx1m
    @user-me7jk9lx1m 11 месяцев назад

    spring kafka ku video poduga bro

  • @phaniharshadasari8685
    @phaniharshadasari8685 3 месяца назад

    Named query, named native query and jpql not covered in video?

  • @sanskaari.24
    @sanskaari.24 8 месяцев назад

    How can we attend your live lectures too?

  • @hiteshsharma9192
    @hiteshsharma9192 3 месяца назад

    This is the first video of urs which is confusing me

  • @Alexis-nv9gl
    @Alexis-nv9gl 10 месяцев назад

    'Promo sm'