title: Can we protect a Domain Model from JSON request not creating a DTO object?
body: <p>For Web/JSON requests  we don't want to expose the entire domain model to the client.  One of the patterns in this case is using a DTO object and then mapping from domain models to DTOs and back.</p>
  
  <p>The example of DTO is LoginUserDTO that is used in JSON requests:</p>
  
  <pre><code>public class LoginUserDTO {
      private String email;
      private String password;
  }
  </code></pre>
  
  <p>In addition we have a User POJO annotated as Entity with much more properties.  By using LoginUserDTO we protect other fields of the User entity to be updated</p>
  
  <p>However, having multiple DTOs creates code repetition, would it be possible to avoid this repetition? I am using Spring/Hibernate with Spring Data</p>