Spring JDBC Template Tutorial: Learn to build a full CRUD application in Spring Boot

preview_player
Показать описание
In this tutorial, you will learn how to list, create, read, update, and delete records from a database in a Spring Boot application using JDBC Template. You will learn how to create a project from scratch, connect to a database, and the various methods in the JDBC Template that allow you to create a full CRUD application.

0:00 Introduction
3:15 Create a new Spring Boot Application
6:00 Create Course Model
8:30 Connect to H2 database
13:10 Create DAO Interface
15:25 Create Course DAO implementation
18:10 List All Courses
25:35 Create a new course
29:50 Read a single course from the database
33:40 Update Course
35:35 Delete Course

🔗Resources & Links mentioned in this video:

👋🏻Connect with me:

Рекомендации по теме
Комментарии
Автор

Very nice work. I have worked with Spring Boot JDBC but i like you CRUD DAO set up. Much cleaner. Thanks for posting this video.

guitarDad
Автор

Thank you very much, this tutorial helped me a lot to undertand the basics of jdbc template.

MsPolish
Автор

Thanks, Dan! Actually, the JDBC API would have sufficed; you don’t need the Spring Data JDBC from the starter page as you’re not using any of the Spring Data features in this tutorial.

Honestly, I like the raw power of SQL, and using the JDBC API allows me to carefully think about the database interactions and have better control over the queries. Spring Data is enough magic already; JPA on top of it is a no-no for me.

Sunil_Veeramuthu
Автор

If you are working with database first approach and you need to write some complex queries with multiple table joins then Spring JDBC is life saver. No need to under estimate it. Spring data jpa is a good choice if you are developing brand new microsercive with code first approach and less complex database schema.

praveens
Автор

Very useful and incredibly informative

fabrizziocordova
Автор

Thanks a million Dan, we would love a follow up to this video with Rest API if you have the time.

kmekky
Автор

very good explanation really loved it
🙂

ahmadraza
Автор

Great Vid i have a Question @Dan Vega
if i am using Spring Data JPA and want to map a Query Result using @Query to a non entity (for example a record used as a DTO) how can i do it ?

michelchaghoury
Автор

Great tutorial! BTW the only think missing here is an example of getting one course that doesn't exists.

georgievvladimir
Автор

Can you show me an example how to create JavaFX project with Spring Boot? No tutorial I found of JavaFX + Spring Boot yet.
I m from India and your new learner...I m waiting for that one. your JDBC Template is very easy to understand .

siddharthasharma
Автор

Hi, how comes that at 24:11 we put the DAO interface in the constructor instead of the class that implements it (CourseJDBCDao)? I don't really get that part. Sorry if its a dumb question.

btryx
Автор

how to call stored procedure using jdbc template in spring boot frame work ?
with in, out and inout parameters ? Hope i will receive the response

jeevanthalluri
Автор

How do you model relations that have inheritance?

DevMERNia
Автор

Nicely done :)

It would have been nice to briefly discuss the pros and cons of this tech against other similar solutions such as JDBI, mybatis (and maybe more?)

I was also slightly confused why you didn’t use the @Repository annotation which could have been a little more descriptive?

pryflack
Автор

Hi there, Could you please explain for me that, when you create a constructor within the CoursePlatformApplication class, and the constructor accepted a DAO as a parameter, but how is DAO parameter got passed to the constructor, I saw you use the "dao" directly in the main function.
Thank you.

xiaoyuli
Автор

Why annotating class that talks to DB as @Component. Isnt @Repository more appropriate? Thank you

dinobulja
Автор

Thanks for this video :)
One question, Do you have created video to work with multiple linked tables (example Student and Course tables having 1:M mapping) with Spring jdbc?
With Spring JPA, its simple as we can define all mapping in entity class, But I want to implement that using Spring data JDBC.

sachinmankotia
Автор

I have a Question. Around 16:55 you said that we need only one instance of "jdbctemplate", so why not make it 'static'?

ShaileshDagar
Автор

If we are using
public jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}


how is the jdbc template being initialized, It needs a DataSource object in it's constructor. Please let me know how this works. Does'nt the existing code gives a null reference

krishnasurisetty
Автор

hi dan!, did you made the tutorial where you build the Rest APItalks with the DAO?

wesleyjackson