From the course: Spring Boot 3 Essential Training
Unlock this course with a free trial
Join today to access over 24,400 courses taught by industry experts.
Solution: Build a data repository - Spring Boot Tutorial
From the course: Spring Boot 3 Essential Training
Solution: Build a data repository
(upbeat music) - [Instructor] Now it's time to take a look at my solution to this challenge. The first thing that I did was I created an entity called Position of type enum. This allowed me to define the enumeration from the data.SQL file. Once this enumeration was created, I created a staff member entity. Looks very much the same that our room entity did. This time, however, I specified the enumerated type of string on the private field position of type position. Once that was done, I went ahead and created a staff repository. And this staff repository looks almost identical to the room repository, as you might expect. And then in the room web app, I simply changed the structure a little bit. I output the rooms. I then put a coupled new lines, put the staff tag and then output the staff. I did also delete the data.SQL and schema.SQL from our application because we no longer need it. Now if you run this, you will see the output starts with all of our rooms. Just like it did before…
Contents
-
-
-
-
-
The Repository pattern4m 27s
-
(Locked)
Introduction to Spring Data3m 42s
-
(Locked)
Building embedded databases6m 2s
-
(Locked)
Building a Spring Data repository6m 4s
-
(Locked)
Connecting to external databases4m 16s
-
(Locked)
Challenge: Build a data repository1m 6s
-
(Locked)
Solution: Build a data repository1m 31s
-
-
-
-