Data transfer Object
주로 데이터 전송에 사용되는 객체
엔티티는 DB에 저장-관리되는 데이터를 의미, DTO는 비즈니스 로직에서 사용되는 데이터 전송 객체
service와 controller에서 원하는 데이터의 종류가 다른 경우 각 계층에서 필요로하는 것들만 DTO에서 묶어서 각 계층에 전달할 수 있다
1. 서버와의 통신에서 네트워크 오버헤드를 줄여준다
2. encapsulation of the serialization's logic
POJO를 주로 만든다 (Plain Old Java Object- flat data structure that contain no business logic)
주로 domain model에서 DTO로 매핑한다 - mapper component (presentation 또는 facade layer에 있는)를 통해 됨 - DTO와 domain model이 서로를 알 필요가 없다
참고
1. https://cobi-98.tistory.com/61#google_vignette
2. https://www.baeldung.com/java-dto-pattern