What is the difference between JDBC Client and Spring Data JDBC?

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

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

  • @richardlin2359
    @richardlin2359 3 หลายเดือนก่อน +1

    Useful Timestamps:
    0:00 -- Intro
    1:01 -- Background
    2:05 -- Initialization
    4:13 -- Docker Compose Database Setup
    5:54 -- schema.sql
    7:43 -- *.java file setup
    8:50 -- JDK
    11:47 -- @Bean CommandLineRunner to test out new entries
    13:43 -- JDBC Template
    18:25 -- JDBC Client
    20:57 -- Spring Data JDBC

  • @lifeisbetterwhenyourelax
    @lifeisbetterwhenyourelax 7 หลายเดือนก่อน +4

    Wow, that's badass! I'm maintaining a very large and old Java 8/Spring Framework 3.x application, so I'm still using Spring JDBC Templates. These new ways of handling CRUD feel like the holy grail. The best part is that there's no JPA and Hibernate (I hate the way Hibernate constructs the most sub-optimal queries). I can't wait to port our current app over to Java 21 and Spring Boot 3, so I can focus much more single-mindedly on business logic. Thanks very much, Dan. You have a new subscriber as of 2 days ago.

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

    This video is awesome, Dan! Short, concise and clear! I have been using Spring on and off over the last 5 years. It's the first time I have understood the different levels of abstraction that Spring provides over native Java. Keep up the great work. I will definitely be watching more of these videos 😁

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

      Wow, thank you so much for the kind words! I'm really glad I am able to help out.

  • @AlexSmile-y2x
    @AlexSmile-y2x ปีที่แล้ว +5

    So what is the difference between Spring Data JDBC and Spring Data JPA in this example?) In what cases the second would be preferable?

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

      jpa has more annotations and magic than jdbc, gotta be careful with side effects of every annotation so u don't end up with data lost and unexpected behavior

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

    Hi, Dan, thanks so much for this video. I happened upon it on FB and the timing couldn't be better. I have a general comment. You are using lots of keyboard shortcuts that I would love to learn (as I use IJ too). It would really be helpful if you used a key stroke display tool. KeyCastr is one example. I don't think it would detract from the main point of your videos, and some of us could learn a lot of additional steps. Thanks for considering this idea.

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

    Hey Dan what a great video, as a person who doesn't like ORM, I would stop at JDBCClient, I found the Repository has lots of magic to it, but you have shown me the ways to do handle SQL between spring and db that's wonderful! thank you!

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

    Great job, Dan! Miss seeing you teach!

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

      I didn't go anywhere, I'm still here :)

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

    Started watching ur videos. Its more informative. From Chennai, Tamil Nadu, India

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

    Cool breakdown, I've used all of them professionally before

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

      Thank you!

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

    Hello Dan! What about a tutorial with one-to-many relatioship(s) with spring-data-jdbc?

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

    I am just wondering @6:31 how does the insert works when the ID is defined as varchar but you enter it as integer value = 1?

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

      Good question, not sure. I would use the varchar in your code or change the id to an int

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

    Excellent video Dan, really appreciate it.
    I was wondering which one of them is volume friendly when dealing with lots of records.

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

      All of them. You go about it a little different. You can page the data. Or you can have a cursor that you may have for a long while. Instructing the driver how many rows per fetch and then stream it in. In some situations paginated data is the preferred as it doesn't lock or have open transactions that long, other times you are fine with that. Other times you must be able to abort and continue. When possible I line to just stream the whole resultset but that often requires some configuration to work and not buffer alot in memory.

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

      @@FredrikRambris I think he meant: Which, between of JDBC Template, JDBC Client, and CrudRepository, handles large result sets most efficiently and without issuing sub-optimal queries?

  • @This.Object
    @This.Object ปีที่แล้ว +2

    Dan, YOU'RE THE BEST

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

      Thank you ☺️

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

    Hello @dan vega, how to invoke oracle stored procedures through jdbcclient with in and out params

  • @RhZ-xd6ts
    @RhZ-xd6ts 11 หลายเดือนก่อน +1

    Hi Dan! Thank you for the video to introduce the Spring new JDBC Client~ It is really convenient to write some complex SQL to bind with some data object. Do you think we can just use the JDBC Client to replace the Spring Data JPA's "@Query" with SQL? Or further more, do you have some suggestions if we want to use JDBC Client and Spring Data JPA together? I love both of them~

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

      He answered your first question in the video. The answer is 'yes.' You're certainly free to write your own queries by hand, using either JDBC Client or JDBC Template. I'll bet there's a way with CrudRepository, too.

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

    wonderful video!!!
    Hwhat font do you use in intellij to recreate the arrow symbol in lambda functions, btw?
    Thanks a lot!!!

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

      I'm using JetBrains Mono which supports Ligatures (that special arrow)

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

    What´s the Spring Data JDBC alternative for Spring Data JPA @EntityListeners? I need to encrypt password when persist data to db and decrypt password when fetch data from database.

  • @Harsh-fd4ml
    @Harsh-fd4ml 10 หลายเดือนก่อน

    Which database you're using for production grade application MySQL or postgresql

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

    Hi, to fetch 1000 records from oracle db it is taking more than 15 seconds. is there any way to fetch data fater from srpingboot application

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

    Yep.. I cleared java professional developer certification, I am clearing Spring Developers certification, after I will specialize myself in Vaadin with Vaadin developer certification

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

    Hello Dan. Great content as always. I will be appreciate if you could create video about spring boot with kafka. Thank you in advance 😉

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

      That would be a lot of fun, thanks for the suggestion.

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

    how to use Spring boot 3.2.0 with Spring DATA JPA and MySQL without docker. I tried but there is still a problem.

  • @DavidYoo-m7z
    @DavidYoo-m7z ปีที่แล้ว +1

    Dan your videos are the best.

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

      Thank you so much for the kind words 🤩

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

    Great video as always Dan! I was wondering why would someone want to use JDBC client instead of Spring Data JDBC or Spring Data JPA? When it comes to integration with a database, then aren't the Spring Data projects much more useful than JDBC client?

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

      I think If I were just getting started with Spring the JDBC Client would be the easiest way for me to talk to a database. Spring Data is awesome but there is an overhead to learning it. Spring Data JPA is even more of a learning curve if someone doesn't have experience with JPA.

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

    Jdbc client is incredible, is very easy to work

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

    Excellent Video !!

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

      Thank you very much!

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

    Hi Dan,
    First of all thank you for very helpful sharing. I wonder what would be the solution for jdbcClient if we had multiple databases and schema.
    Cheers,
    Ibrahim.

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

      That is something I see many struggle with as Spring Boot does not really help much with that. You will have to provide two beans of type DataSource. Each with its own @PropertySource (not sure of that name, writing from memory), then provide two Beans of type JdbcClient, each depending on the respective DataSource. Then you can autowire the two JdbcClients (same for JdbcTemplate and similar for the reactive side).

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

      Thanks for the great question. I am going to record a tutorial on this but here is the repository for now.
      github.com/danvega/multiple-ds

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

      @@FredrikRambris thank you for the answer. I saw these solutions but it requires coding. Maybe it's possible to get that beans by qualifier name.

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

      @@DanVega is it the same with spring-boot-data-jdbc?

  • @Nico-ly7lh
    @Nico-ly7lh 5 หลายเดือนก่อน

    Very similar to hibernate, isnt it?

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

    what is the difference between Spring Data JDBC and Spring Data JPA?

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

    Hi, Dan. I think, when you're creating a video tutorial/overview on a topic X, it's better to concentrate on that X. I'm watching this now and thinking, that if a docker-compose, docker, or generally any other unrelated thing isn't really a clear concept for someone, he/she will need to divert from here to some other paths and all this makes it harder and a bit scattered to learn something. Concentration is already a big problem for a modern person, and if it's possible to keep a tutorial focused, it will greatly improve the experience. Respect.

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

      He mentions at the beginning of the video that if someone doesn't want to use a database via Docker, they can also use an H2 database. And by the way, as a "modern" software developer, some experience with Docker can't hurt. It is not particularly difficult to learn, but at the same time offers many advantages.

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

      Normally I try and keep things simple but I also try and mention features folks might not know about. I mentioned it early on, if you don't want to use Docker I get it and H2 would be a simple change.

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

      @DanVega mentioning features folks might not know may include a lot of other things, as well, then. Touching upon how Spring Boot works.. how DI is implemented and etc. Anyways, takeaway is that tutorials should better be on a one specific topic and include as minimum of other things as possible. E.g. if H2 is possible, why overload this with mentioning Docker and then referring the audience to go and watch another tutorial(s) on Docker..? :) I'm just trying to help you in having a better content.

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

      imagine that there's a parallel world, where Dan made this video exactly per your suggestion - only mentioning that theres a database, then presenting those different access options. A variant of you from that world would comment "Dan, but how can anyone follow your tutorial if you don't show how to spin up a database. It will greatly improve the experience". Or some yet another variant would comment "This H2 stuff is hard...".🙂
      No, it's simply not possible to cater to everyones tastes man. It was actually well executed and concise. I would only argue that DataSource managed by Spring was not pure JDK, but hey-close enough 😁

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

    why you left VMware

    • @static-m-s
      @static-m-s ปีที่แล้ว +1

      VMWare was acuired by Broadcom recently

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

      Oh okay good to know 😅 glad to see videos from Dan

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

    Hi Dan, would you please help in clearing the doubt, why there are so many "spring data" module and when to use which one? Here is the list, and it's getting confusing / ambigous:
    --> spring-boot-starter-data-jpa
    --> spring-boot-starter-data-jdbc
    --> spring-boot-starter-jdbc
    --> spring-data-jpa
    --> spring-data-jdbc
    --> spring-jdbc
    Could you please help demystify why so many modules are there ?