Java Spring Boot [2024] Part 2: Database, Entity, Repository, Service

preview_player
Показать описание
Join my Patreon:

LinkTree:

SQL scripts:
use nobsv2;

CREATE TABLE product(
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255),
description VARCHAR(255),
price DOUBLE
);

INSERT INTO product (name, description, price) VALUES
('Apple iPhone 14', 'Latest model with 256GB storage A15 Bionic chip, and improved camera system', 999.99),
('Samsung Galaxy S21', 'Flagship phone with 128GB storage, Exynos 2100, and triple camera setup', 799.99),
('Sony HW-1000XM4', 'Wireless noise-cancelling headphones with up to 30 hours of battery life', 3499.99);

select * from product;

FULL PLAYLIST:

LinkTree:

0:00 Intro
1:25 Model Product Class
2:43 Repository
4:20 Run SQL scripts
5:30 Test in Postman
5:42 rename classes
6:00 HTTP request explained
8:13 DTO Data Transfer Object
9:25 Update CreateProductService
10:47 Update GetProductsService
11:23 new endpoint for GetProductService
13:17 Update UpdateProductService
15:25 Update DeleteProductService
16:23 Update Controller
17:00 Test in Postman
18:34 Test in mySQL Workbench

#java #javaframework #learnjava #learntocode #javatutorial #javaforbeginners #springboot #springboottutorial #javaspringboot #backendframework #backend #backendwebdevelopment #mysql #sql #repository #service #http #httprequest
Рекомендации по теме
Комментарии
Автор

Here is the link to the full playlist:

The Number #1 question I get on this video is:
Why are we running a SQL query to generate my table? Can't Spring Boot (and specifically the ORM) do that for us?

The answer is YES. If you add this to your properties file then you won't have to run your SQL scripts to generate tables or update columns.


I cover this at the very end of the course.

I don't like to cover this earlier because most people here are new to backend web development. For learning purposes, I think it's important that you understand how entities match up to SQL tables and how to do it manually. Once you finish the course (or already have experience), then you can start using the shortcuts.

Good luck!

peachezprogramming
Автор

If anybody has used Nest JS, they'd feel right at home with this. Great video and tutorial

nanonkay
Автор

Subbed, this is THE right amount of concise tutorial series for SpringBoot on youtube. Request : Can you do a tutorial on Jhipster + Springboot?

SarthakSPyt
Автор

GREAT job! Congratulations for your teaching skills.

florinbujoreanu
Автор

Good tutorials, much more understandable for me when slowed down below 1.0x speed. Kinda hard to keep up sometimes.

mihajlocolic
Автор

The content is very good and literally no bull shit just right to the point. But I would suggest bumping the ide font size it would seriously help a lot of people like me. Thanks

saurabhjangra
Автор

If you face the following error:
Parameter X of class constructor Y could not be found. Consider defining a Bean of type...

Where X is a number 0 or 1 and Y is one of the classes, be sure to check the dependency versions. I had more modern ones than the ones used in the video and the exact same code failed to compile giving me this nonsense error

morezco
Автор

9:18, I'm not getting the getId(), or getDescription options, its suggests to create these methods in the Model file, but you didn't create any methods, what can be the issue?

SarthakSPyt
Автор

Are the @Table and @Column annotations necessary if your mysql table name and column names are one word? I also noticed that your api endpoint is "product" instead of "products". Is this the standard or will it vary between codebases? I ask this because my instructors hammered a plural naming convention for restful api design.

michaelharrington
Автор

Do anyone know why is returning array with empty objects? If I have 6 entries in DB, it return literally [{}, {}, {}, {}, {}, {}]... I tried everything I could but I not managed to find a solution to my stup1d question =T

adiosdimi
Автор

Why create a Service class for each http verb/action? Why not just one ProductService class with all those methods?

connorabbas
Автор

you think you can make a video on git?

king-tz
join shbcf.ru