Use DTOs in Java to shape data crossing process or layer boundaries without leaking domain models or persistence details directly.
DTO is still a useful Java pattern, but not because “enterprise systems must always have DTOs.” It matters when a boundary needs its own data shape: API payloads, messaging contracts, external integration objects, or read-optimized views that should not expose the full domain model.
This section treats DTO as a boundary-shaping pattern. The key questions are what data crosses the boundary, what stays behind, how mapping is owned, and when a DTO is clearer than passing entities, records, or domain objects directly.