What are the DAO, DTO and Service layers in Spring Framework?

后端 未结 5 1849
陌清茗
陌清茗 2020-12-12 10:29

I am writing RESTful services using spring and hibernate. I read many resource in internet, but they did not clarify my doubts. Please explain me in details what are DAO

5条回答
  •  星月不相逢
    2020-12-12 11:24

    SERVICE LAYER:

    It receives the request from controller layer and process the request to Persistence layer

    • @Controller:It is the annotation which initialize whole controller layer.
    • @Service:It is the annotation which initialize whole service layer.
    • @Repository: It is the annotation which initialize whole persistence layer.

    DTO:

    It is an Data Transfer object which used to pass the properties from service layer to persistence layer.

    DAO:

    It is an Data Access object. it is also known as persistence layer. In this DAO we receive property values from service layer in DTO object. Here we write an persistence logic to db.

提交回复
热议问题