I have 3 DAO and service classes for project, customer, and issues. I have one more jiraService class in which I use the JIRA API. The use case is that I use APIs to create the issue in JIRA for a customer's project. Once the issue is created I store the customer info. in the customer table, the response info. from JIRA in issue table and then store the issue id, customer id in project table so that I know which issue is related to a which customer and project. Now I have some questions -
- How should I call the DAO classes from jiraService class? Is it good to directly call the required DAO class as I am in a service class or should I call it through the service class which I have created for that DAO class?
- DAO classes are supposed to contain CRUD methods only. But there can be variations in say READ operation. For example, I may want to get projects on the basis of customer name or on the basis of issue id or both. We cannot create a generic GET method for this. So is it considered a good practice to include all required variations of CRUD operations in DAO classes?
- How should one DAO class call methods within other DAO class? For example, I have the customer name and I am fetching all project info for that customer. In my project table I have customerId stored so I need to first get the customerID for that customer and then fetch all the projects from project table using customer ID. How should I call the getCustomerID method within customerDAO from projectDAO class?
Aucun commentaire:
Enregistrer un commentaire