From the course: Spring on Kubernetes: Deploying and Managing Cloud-Native Applications
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Building data access - Spring Boot Tutorial
From the course: Spring on Kubernetes: Deploying and Managing Cloud-Native Applications
Building data access
- [Instructor] Now it's time to write some code and build out our data access. So, open up Wisdom API. Go to Source, Main, Java, and under the Wisdom package we want to create a new Java package, and it's going to be data.entity. Under the Entity package, we will create a new Java file and this is going to be a class, and we will call this Customer. Now, you can look at what we are going to populate by going to the data.sql, going to the customers table, and you will see that there are several values here. There's actually six. So, we're going to leverage those to build this out. So, the first thing that we needed to do is we need to say that this is an entity from jakarta.persistence, and then we also need to do an @Table construct because the table name is not straightforward for the way that Hibernate expects it because I use plural. So, customers, let's make sure we import that, and now we're going to add a Lombok annotation called @Data. Now we will do an @Id from…
Contents
-
-
-
Cloud native applications6m 15s
-
(Locked)
Creating the application3m 22s
-
(Locked)
Preparing data access6m 45s
-
(Locked)
Building data access4m 2s
-
(Locked)
Exposing as a webservice4m 43s
-
(Locked)
Challenge: Cloud Native Spring1m 25s
-
(Locked)
Solution: Cloud Native Spring4m 24s
-
(Locked)
Logging with Spring5m 7s
-
(Locked)
Metrics with Spring6m 20s
-
-
-
-
-