Entity to DTO – how-to

Click for: original source

DTO is probably the most straightforward pattern in object-oriented programming. What could be the motives for using DTOs in our applications? By Andrey Belyaev.

In this guide you will find information about:

  • Introduction: what is DTO?
  • Where do we need DTOs?
  • DTOs for API layer
  • Entities vs. DTOs on the business layer
  • No-DTO approach
  • How to map an entity to DTO?
  • POJOs and Hibernate
  • POJOs and mappers
  • Spring Data JPA Projections

It is hard to avoid DTOs in modern business applications. The most common reason to use them – stabilize the application’s external API and hide some information from the data transferred via this API. Nice one!

[Read More]

Tags database oop web-development app-development java