Spring Data JDBC Tutorial: How to simplify data access in Spring Boot

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ต.ค. 2024

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

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

    finally someone smart talking about tracking entity changes! thank you so much Dan!

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

      Thank you, Max!

  • @Eiseskälte
    @Eiseskälte 11 หลายเดือนก่อน

    As an Android dev, I am used to build databases with sqlite without any annotations. This is working for me since years in real world apps. So diving in the Hibernate stuff, it feels like a pain in the ass to do even simple inserts.
    I will give JDBC a try! Thanks for your tutorial!

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

    I never used Spring data JDBC before but this video opens a new perspective for me about having more understandement and about relationships. Thank you Dan ! This makes wanna dive more and how to do a few things with spring data JDBC :
    1. Pagination of the Comments within a Post when reading a Post, assuming we had to add it as feature
    2. Filtering and sorting of Comments with a given post
    3. Transactions between Post and Author

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

    Thanks for clearing my confusion about Aggregates and how they are related.

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

      You are welcome!

  • @omkar.at.office
    @omkar.at.office ปีที่แล้ว +1

    Awesome presentation! I have used Spring Data JDBC in one of my side projects. Initially it took some time to understand, but it simplifies many things as compared to JPA. Thanks.

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

    I found this channel today and I had to subscribe. Great content 👏

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

      Thank you!

  • @eni4ever
    @eni4ever 2 หลายเดือนก่อน +1

    "I've been blogging for 20 years and I've never got comments" ... Savage!
    Also, subbed! Thank you, Dan!

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

    Awesome tutorial, I liked the in aggregate solution i.e between Post and Comment. I am curious on how you would go about to solve to oddities below
    1. Pagination of the Comments within a Post when reading a Post, assuming we had to add it as feature
    2. Filtering and sorting of Comments with a given post
    3. Transactions between Post and Author

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

    this channel is pure gold

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

    Thank you Dan. Was looking for this

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

      Glad to help

  • @NullPointerDeception
    @NullPointerDeception 3 หลายเดือนก่อน

    Nice walkthrough! I'm not sure (Post, Comment) is a good aggregate. It may work for a tiny blog where posts usually have 10 comments, but as soon as you go in the hundreds & thousands of comments, with comment threads, this stops being a viable design. Treating it as a consistency boundary in that case is crazy.

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

    Your channel is a goldmine!

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

    Great tutorial, it was really helpful. One thing that left me a bit disappointed is you mentioned the "version" column in the Post entity, which is something specific to Spring Data JDBC but did not really explain it. Do you know where I can read more about this concept? Cheers

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

    Loved your video

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

      Appreciate it!

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

    Over the years being in different teams and working with different people, i have come to the conclusion that JPA and Hibernate is poorly understood by the majority of people and usually it makes more harm than help. I personally always use Spring JDBC and write plan SQL queries for everything along with RowMappers. Having a strong grasp of SQL helps me have full control over everything and i don't have to care about some strange behavior of JPA and Hibernate.
    Anyway if the people at the team understand it properly, than i see no issues with using it.

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

    great tutorial. could you please show how to solve this using JPA and entity mapping? thanks

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

      Great suggestion! github.com/danvega/office-hours/discussions/41

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

    😁I will read ur blogs and leave comments since today.

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

      Dan, i found that no comment input text in your blogs. NVM, i will read your github discussions.

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

      I turned off blog comments. You can always email me or reach out to me on twitter. check out danvega.dev for all of my info.

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

    @Dan Vega Please do one on Spring Data JPA

  • @hareeshkumar7468
    @hareeshkumar7468 8 หลายเดือนก่อน

    Hi Dan! I want to know how to implement pagination + inner conditions like (condition OR condition) AND (condition OR condition) in spring data jdbc. Please help
    out on this

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

    thanks a lot. great tutorial

    • @DanVega
      @DanVega  2 ปีที่แล้ว

      You are welcome!

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

    Thank you

    • @DanVega
      @DanVega  2 ปีที่แล้ว

      You're welcome

  • @JasmineTrader-mw8ru
    @JasmineTrader-mw8ru ปีที่แล้ว

    If i were to change database feom postgres to mysql, say. How much effort would it take? What are the steps to proceed

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

    So if I want to see only list of posts without comments on /posts, I need to look at them as separate aggregates, right? And in single post view I would load that comments (/posts/1).

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

    Thanks.

    • @DanVega
      @DanVega  2 ปีที่แล้ว

      You're welcome

  • @vipinkoul595
    @vipinkoul595 10 หลายเดือนก่อน

    Hi Dan, this is very good tutorial. Some doubts, could you please help in clarifying. 1) In spring-data-jdbc, how are classes mapped to actual table where data gets persisted? In the application that you showed, Post is a class (and since we are not using JPA, so we don't have @Entity annotation), how does this module come to know which table in DB does it need to persist a class? 2) Since spring-data-jdbc doesn't use any ORM , so how does this mapping is happening 3) I was under (mis) conception that Repository is available for spring-data-jpa only , but it seems that Repository concept is in spring-data-jdbc as well (so we can use simple repo.save()) - this is confusion; as same / similar functionality is provided by spring-data-jpa; what exactly is the differnce and how sping-data-jdbc is able to achieve this, even without having ORM (which does table == Class mapping etc.). Could you please help in clarifying this doubt?

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

    Around 33:19 you are querying rows from comment table. There's no primary key. How can we have multiple comments on the same Post-row?

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

    I'm puzzled
    Entitys identity should be based on primary key, and on primary key only (otherwise it is a value object)
    However, you are using record as Author entity without overriding equals (and hashCode). How can this even work?

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

    Assume there have many comments, if the JDBC will delete all comments before add new one to make sure consistent but result in lower performance?

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

    I was thinking that a comment would also be associated with an 'Author' i.e. the author of that comment. Could aggregates overlap to share entities? In this case, 'Comment' would be shared with the aggregate having 'Author' and the other one having 'Post'. Could this be possible?

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

    Hello, can you explain me why i have "Internal Server Error" when i run this https request in postman? Thanks

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

    Hey Dan. Can I do same thing without using JDBC using only java 8 stream?

  • @CATO_YT
    @CATO_YT 7 หลายเดือนก่อน

    What's the use of author repository?

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

    can we use spring data jdbcd combine with spring data jpa

  • @mihirsawant8817
    @mihirsawant8817 2 ปีที่แล้ว

    Do we have to mark command line runner as @Bean explicitly, will spring not automatically take into context as it's comnand line runner..

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

      Yes you need to mark it as a bean. If you create a class that implements the CLR you will need to mark that with @Component.

  • @vrjb100
    @vrjb100 23 วันที่ผ่านมา

    Put everything related to post in one package, model, repository, service and controller are related to each other.

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

    Why not use Lombok for getters and setters

  • @igorpavlenkov3658
    @igorpavlenkov3658 2 ปีที่แล้ว

    great video

    • @DanVega
      @DanVega  2 ปีที่แล้ว

      Thank you, Igor!

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

    Hi Dan, thank you so much on this video, I am big fun of your work :). I downloaded and tried code from this video but it didn't work. Can you please check? Thank you so much.

  • @viewer_evgeniy
    @viewer_evgeniy 11 หลายเดือนก่อน

    Where is your blog? I want to leave a comment.

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

    This is really insane... jdbc, jdbctemplate, jpa, spring data jpa, spring data jdbc, hibernate... It's really hard to understand what is what and when to use what...

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

    Great. Just when i was about to quit on dealing a simple öne-to-many rel. with JPA

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

      AHAHAHA I hate this HATE relations in JPA, now, I'm like you

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

    How Data JDBC knows that the COLUMN 'first_name' in the DB refers to the class attribute 'firtstName' ?