From my understanding of the level of service, I do not know how you generated it; if it is written correctly, it should be based on your business model and should not fully follow your database schema. Unlike a DAO (maybe I actually also donβt have a DAO from one to one object), you should not have a service for each object, instead, your services should either use the objects as part of their API to run units or deliver Business objects, which are the level of abstraction between control logic and data access. It can also be a hybrid of both. It depends on the complexity of the application and how closely your DAO / Entities are closely related to your database.
EDIT: based on your comment and a great hurry, I would use the tools mentioned in other posts to create your DAO layer, which will give you a very good start. Then I will create one service object that contains all your DAOs. From there, you will have access to all business logic in the test container (service object). This will not allow you to put it in controllers and will provide one place where people can see all the methods of business logic. As it grows, you will see layoffs and logical units, which you can subsequently divide into different service facilities.
I hope you have time to do this, but when I am in a huge hurry, I like that all my complexity in business is in one service object, unlike many controllers. Refactoring, which you will do later, will be much easier. And yet you can easily test the methods that I would recommend, regardless of rush, believe me, itβs faster to write tests on service methods than to test them, deploying and checking.
walnutmon
source share