I assume if you're using DTO and DAO, there is no need for entities, at least examples that i saw in this way. Or is it optional to have entities in this scenario ?
public interface CustomerResource {
@GET
@Path("/getCustomerListByUserID/{userID}")
Response getCustomerListByUserID(@PathParam("userID") String userID);
@DELETE
@Path("/deleteCustomer/{customerID}")
Response deleteCustomer(@PathParam("customerID") int customerID);
@POST
@Path("/updateCustomer")
Response updateCustomer(CustomerDTO customer);
}
public class CustomerResourceImpl implements CustomerResource{
@Override
public Response deleteCustomer(int customerID) {
internalService.deleteCustomer(customerID);
}
@Override
public Response getCustomerListByUserID(String userID) {
internalService.getCustomerListByUserID(customerID);
}
@Override
public Response updateCustomer(CustomerDTO customer) {
internalService.updateCustomer(customer);
}
}
public interface CustomerDAO extends BaseDAO<CustomerDTO> {
List<CustomerDTO> getCustomerListByUserID(String userID);
void deleteCustomer(Integer customerID);
void updateCustomer(CustomerDTO customer);
}
And internalService directly calls CustomerDAO
Are there anything wrong about this structure, how can it be better, is there any need for Customer entity?
Thank you so much ! Wish success for you all !
Aucun commentaire:
Enregistrer un commentaire