9 Replies Latest reply on Jan 10, 2007 12:58 AM by jschellSomeoneStoleMyAlias

    DAO and DTO

      In the following piece of code:-
      package com.informit.myejb.dao;
      public interface SampleDAO
       public SampleModel create( long id, String name, String data ) throws 
       public void delete( long id ) throws SampleDAOException;
       public void update( long id, SampleModel model ) throws 
       public SampleModel[] findByName( String name ) throws 
       public SampleModel findById( long id ) throws SampleDAOException;
      we are creating a DTO named sampleModel. Now considering that I just need one value out of the whole table. Wouldn't creating the whole DTO object be a waste of time effort and memory, specially if each time we hae to access the DTO we have to create a new one. specially if the keys being passed to the method are used only once.

      I understand the concept of separation of concerns but I am concerned over here about the amount of effort required to create these DAOs and DTOs specially in cases where only one or two fields are required.

      To me it seems like an over kill.

      Any comments.