Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Design pattern for Java Spring data JPA projects

This is my current project design
Controller-> service -> Repository

I am trying to understand :

  1. What layer(Name) i can create between Controller-> service if in
    case i need to have layer which can be composition of services.

    MEDevel.com: Open-source for Healthcare and Education

    Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

    Visit Medevel

  2. What layer I can create between service -> Repository .

  3. If i am having Repository Layer can i also keep DAO layer.

Many Thanks.

>Solution :

The service layer is the thing you need to use when manipulating with data retrieved from db. So you do not need to create extra-layers between controller-service-repository. The main idea is to use repository for db operations, service for data manipulation + additional logic, controller for creating api. Or there is an approach with additional api layer where you create api interfaces then controller implements them and then service(logic) and repository(sql)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading