Using Spring MVC we normally see Controller, Service and Repository layer. The Repository layer uses Entity model which is one to one mapping with database. I thought of following -
- Should Service layer use the same Entity model?
- Should Service layer use separate Domain model? If yes then the to/fro mapping should be done in Service layer?
- Should Controller layer we use the same Domain model?
- Should Controller layer use separate DTO model? If yes then the to/fro mapping should be done in Controller layer?
- Do we have any simple way to do mapping without writing too much verbose code? I have used Dozer few times in the past.
This question may have been asked but I could not find. So excuse me for duplicate question.