In the company I work with, we have a 3-layer architecture in our micro-services and the flow is like this:
Repository/DAO (entity) => Service (entity) => Controller (dto)
Now I am working on a search feature, and I need to perform a query with Spring Data JPA/QueryDSl that spans (joins) multiple entities (tables) in the database and must return only the fields needed to the UI.
For this purpose I wanted to create a DTO in my repository that represent data needed by the UI.
However, some guys in my team told me that the DTOs are the Controller responsibility and they must be send directly over the network and not send through the app layers.
So, how can I handle this without retrieving all the columns (I have a join with 8 tables with data scattered over multiple tables)?
If I go with a different name like FooView
or FooProjection
, should I make a extra mapping View => DTO
in the controller layer or send it directly as FooView
?
Aucun commentaire:
Enregistrer un commentaire