From the course: Building Role-Based Access using AI for Java Developers

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Implement the personal account service

Implement the personal account service

- [Instructor] Now that we have our repository layer, we need to create a service layer on top of it. But what's the use case? Now consider if you want to expose all of this functionality using a RESTful APA or a GraphQL API, you would not want those implementations to know about the underlying database that you're using. But with account repository, it is clear that it is using a MongoDB, so that is too tight of a connection. Also, if you want to perform any business logic, the account repository is not the right place to do such kind of a thing. So we need another layer and that's called service layer, which hides, or which sits in between your API consumers and your repository layer. So we are going to build the service layer for accounts and we are going to do that now using AI. So I'm going to write my prompt first. Create a new class called PersonalAccountService inside service package because we want to organize our code correctly. Within this class, what we need is add…

Contents