title: Inheritance and DTO object design
body: <p>I am developing a standalone J2SE application (Can't add J2EE, Hibernate, Spring, etc...). I need idea on designing the code architecture.</p>
  
  <p>This is my code:</p>
  
  <pre><code>class PersonBean {
  
      String name;
      int id;
      public String getName() {
          return name;
      }
      public void setName(String name) {
          this.name = name;
      }
      public int getId() {
          return id;
      }
      public void setId(int id) {
          this.id = id;
      }   
  }
  
  
  class PersonMapper{
      PersonMapper(Connection conn){
  
      }
  
      PersonBean load(ResultSet rs){
          PersonBean entity = new PersonBean();
          entity.setId(rs.getInt("id"));
          entity.setName(rs.getString("name"));
          return entity;
      }
  
      PersonBean findById(int id){
          String query = "SELECT * FROM Person where id = ?";
  
          PreparedStatment stmt = conn.getPreparedStatement(query);
  
          stmt.setInt(1, id);
          ResultSet rs = stmt.executeQuery();
  
          if (rs.next())
              return load(rs);
  
          else
              return null;
      }
      List&lt;PersonBean&gt; findByName(String name) {}
  }
  </code></pre>
  
  <ol>
  <li>Created entity classes for each Table (mysql table), with getter
  and setter, named it as Bean.class (PersonBean.class)</li>
  <li>Created mapper classes for each table to retrieve records for
  that table,and populate entity. Named it as Mapper.class
  (PersonMapper.class).</li>
  </ol>
  
  <p>Is there anything do I need to do to improve this design?</p>
  
  <p>In object world Student object extends Person object. But in database Student and Person are two different tables, which leads to create two different classes for StudentBean and PersonBean where StudentBean will not extend PersonBean. Do I need to create business layer on top of entity Bean object layer? if so how to design?</p>
  
  <p>I don't know how to start browse about this, any links also would be fine.</p>