Best practice to call a Repository class method in another Controller-Service-Repository in Spring Boot? The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceHow to add a filter class in Spring Boot?Spring Boot application as a ServiceShould services always return DTOs, or can they also return domain models?Spring Boot REST service exception handlingCan't Autowire @Repository annotated interface in Spring BootSpring-Boot Custom RepositoryMain concepts of spring security with JWT tokens (Spring boot with REST controllers)Unit Test Spring Boot with Controller -> Service -> RepositoryBest practice to organize service,service implementation and repository in a spring boot applicationBest Practice to share spring boot repositories and DTO

How to begin with a paragraph in latex

What is the numbering system used for the DSN dishes?

Could a cockatrice have parasitic embryos?

When does Bran Stark remember Jamie pushing him?

What do you call an IPA symbol that lacks a name (e.g. ɲ)?

Is it OK if I do not take the receipt in Germany?

How long can a nation maintain a technological edge over the rest of the world?

Retract an already submitted Recommendation Letter (written for an undergrad student)

How to compute a Jacobian using polar coordinates?

Putting Ant-Man on house arrest

What were wait-states, and why was it only an issue for PCs?

Marquee sign letters

Processing ADC conversion result: DMA vs Processor Registers

Did war bonds have better investment alternatives during WWII?

Does using the Inspiration rules for character defects encourage My Guy Syndrome?

Israeli soda type drink

What does こした mean?

Are these square matrices always diagonalisable?

Preserving file and folder permissions with rsync

Protagonist's race is hidden - should I reveal it?

RIP Packet Format

When I export an AI 300x60 art board it saves with bigger dimensions

What to do with someone that cheated their way though university and a PhD program?

/bin/ls sorts differently than just ls



Best practice to call a Repository class method in another Controller-Service-Repository in Spring Boot?



The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceHow to add a filter class in Spring Boot?Spring Boot application as a ServiceShould services always return DTOs, or can they also return domain models?Spring Boot REST service exception handlingCan't Autowire @Repository annotated interface in Spring BootSpring-Boot Custom RepositoryMain concepts of spring security with JWT tokens (Spring boot with REST controllers)Unit Test Spring Boot with Controller -> Service -> RepositoryBest practice to organize service,service implementation and repository in a spring boot applicationBest Practice to share spring boot repositories and DTO



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








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)










share|improve this question






















  • 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 9 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
    Mar 9 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
    Mar 9 at 13:10

















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)










share|improve this question






















  • 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 9 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
    Mar 9 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
    Mar 9 at 13:10













1












1








1


2






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)










share|improve this question














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)







spring-boot architecture spring-data-jpa mdd






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 9 at 4:32









Vyshnav RameshVyshnav Ramesh

124113




124113












  • 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 9 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
    Mar 9 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
    Mar 9 at 13:10

















  • 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 9 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
    Mar 9 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
    Mar 9 at 13:10
















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 9 at 12:42





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 9 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
Mar 9 at 13:04






@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
Mar 9 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
Mar 9 at 13:10





@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
Mar 9 at 13:10












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55074004%2fbest-practice-to-call-a-repository-class-method-in-another-controller-service-re%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55074004%2fbest-practice-to-call-a-repository-class-method-in-another-controller-service-re%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко