1

enter image description here

Image Description: The image represents the backend coding of my application designed in MDD architecture, say chan 1 corresponds to model Complaint and chain 2 corresponds to model Location.

Working: The client makes request to backend at Location controller passing an argument 'complaintId', and expects a Location corresponding to it. This work is to be done by method in Complaint repository using an inner join query.

Question: My question is how should I call this method: C2-S2-R1? C2-S2-S1-R1? C2-S1-R1?

(NOTE: Though there are many patterns described already in SO, solution to this question wasn't found. I would also appreciate if anyone could post an already answered link here. ty)

  • Begs the question why would you have a location “api” (controller) accepting a complaint id. What does your API look like now? But anyway your service should make calls to whatever repositories it needs. Design your services around some business process versus just having “LocationService” that just wraps a repository call. – Strelok Mar 09 '19 at 12:42
  • @Strelok "why would you have a location “api” (controller) accepting a complaint id": this is because Complaint has unidirectional ManyToOne mapping with Location. Since I want Location of a Complaint as response (given conplaintId) I called Location controller (please correct me if I should have called Complaint Controller) – Vyshnav Ramesh Thrissur Mar 09 '19 at 13:04
  • @Strelok "But anyway your service should make calls to whatever repositories it needs": means I can call ComplaintRepository from LocationService directly? ...without calling via ComplaintService? – Vyshnav Ramesh Thrissur Mar 09 '19 at 13:10

0 Answers0