From the course: Building Java Microservices with gRPC

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Add database method to get user details

Add database method to get user details

From the course: Building Java Microservices with gRPC

Start my 1-month free trial

Add database method to get user details

- [Instructor] Now that we have the database connection code set up the database script is ready with us and all that initial set up is done, the next step will be to add a data access object class for the user table. So we're going to add a class which queries the user table, gets the details of the user for us throughout the database. So let's go back to the IDE and add a class here, let's called that UserDao, which is data access object. And the data that we're going to query from the database should sit in some domain object. So let us create a domain object for that. I will go on the same package, create another class called let's say just the User. So this user class will have few fields, which correspond to the columns of the user table. So let's call those quickly. There will be an ID, there will be a String_username. They will be another String_name, another one for age which is integer and then let's take a…

Contents