title: DTO's, DAO or Service layer?
body: <p>My application is based on the typical 3-tier layer architecture and the goal is to create a SpringMVC site and a Spring Batch solution which feeds and maintains our database's products and stock, where speed is a very important factor.</p>
  
  <p>I'm using Spring's <strong>JdbcTemplate</strong> to manage a legacy database. Some of my tables contains lots of columns I don't use, and retrieving the whole rows has shown a negative impact due to the size of some fields (blobs we don't even need to map), so I created some beans matching the columns I want to retrieve, such as:</p>
  
  <ul>
  <li><strong>Product</strong> -- Contains a 1:1 relation with the fields stored in the DB.</li>
  <li><strong>ProductDetailsView</strong> -- Contains id, name, price, description, stock.</li>
  <li><strong>ProductListItemView</strong> -- Id, Price, name, stock.</li>
  </ul>
  
  <p>The DAO layer returns these beans to the service layer. AFAIK creating a DTO to expose it in my services interface for <strong>Product</strong> might make sense, but,</p>
  
  <p>1) What about <strong>ProductDetailsView</strong> and <strong>ProductListItemView</strong>? </p>
  
  <p>2) Should I do a 1:1 mapping from these 'views' or 'projections'  into DTOs with the same attributes? Why?</p>
  
  <p>3) In any case, where would you place <strong>JSR-303</strong> annotations to validate the web's input?</p>