title: Component reuse in common module
body: <p>I have two components in a Java EE web application. These components differ only on two to three fields. Both perform the same action i.e. save data in the database and send some mail. What would be a better way to implement them? Currently I have two options:</p>
  
  <ol>
  <li><p>Have a common vo, pass base class to service and dao layer, then based on the object type do the necessary actions in the DAO class as both the modules' data sit in two different tables.</p></li>
  <li><p>Have common interfaces, common vo but a separate service and DAO.</p></li>
  </ol>
  
  <p>Can anybody let me know what is better and why or if there is a better way?</p>