title: mapping SQLquery to plain Object, not Entity
body: <p>I have following <strong>Java method</strong>:</p>
  
  <pre><code>public void loadData()
  {
    session = DaoSF.getSessionFactory().openSession();
    String sql = "select s.column1, SUM(s.column2), 'hi' as column3 from Source s group by s.column1";
    Query query = session.createSQLQuery(sql).addEntity(Test.class);
    dataList = query.list();
  }
  </code></pre>
  
  <p><strong>Class Source</strong>:</p>
  
  <pre><code>@Entity
  @Table(name="SourceTable")
  public class Source implements Serializable 
  {
    @Id
    private int column1;
    private int column2;
    + getters and setters
  }
  </code></pre>
  
  <p>Appropriate <strong>class Test</strong>:</p>
  
  <pre><code>@Entity  // why?
  public class Test implements Serializable 
  {
    @Id
    private int column1;
    private int column2;
    private String column3;
    + getters and setters
  }
  </code></pre>
  
  <p>And <strong>hibernate mapping</strong>:</p>
  
  <pre><code>...
  &lt;mapping class="objects.Test"/&gt; // why?
  &lt;mapping class="tables.Source"/&gt;
  ...
  </code></pre>
  
  <p><strong>Everything is working fine</strong>, but i don't understand one thing:</p>
  
  <p>Why the object <code>Test</code> has to be mapped in <code>hibernate.xml</code> and signed by <code>@Entity</code> tag, if it has no reflection in real SQL server? Why it couldn't be a 'plain' Java object?</p>
  
  <p>When I delete <code>@Entity</code> and <code>&lt;mapping class="objects.Test"/&gt;</code> it reports following error:</p>
  
  <pre><code>org.hibernate.MappingException: Unknown entity: objects.Test
  </code></pre>