title: Hibernate retuns list with null values when querying Oracle views
body: <p>when querying Oracle views with Hibernate 4 I get back a list with a size bigger than 0, representing the count of elements I get when running the same query in SQL Developer for example. When I loop through the list, I however only get null values.</p>
  
  <p>My hibernate.cfg.xml looks like:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
  &lt;session-factory&gt;
      &lt;property name="hibernate.connection.driver_class"&gt;oracle.jdbc.driver.OracleDriver&lt;/property&gt;
  
      &lt;property name="hibernate.connection.url"&gt;jdbc:oracle:thin:@127.0.0.1:1521:OUT&lt;/property&gt;
      &lt;property name="hibernate.connection.username"&gt;username&lt;/property&gt;
      &lt;property name="hibernate.connection.password"&gt;password&lt;/property&gt;
      &lt;property name="hibernate.default_schema"&gt;schema&lt;/property&gt;
  
      &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.Oracle10gDialect&lt;/property&gt;
  
      &lt;property name="hibernate.connection.pool_size"&gt;1&lt;/property&gt;
  
      &lt;property name="hibernate.current_session_context_class"&gt;thread&lt;/property&gt;
  
      &lt;property name="hibernate.cache.provider_class"&gt;org.hibernate.cache.NoCacheProvider&lt;/property&gt;
      &lt;property name="hibernate.hbm2ddl.auto"&gt;update&lt;/property&gt;
  
      &lt;mapping resource="be/comp/model/db/VwPersoneelslid.hbm.xml"/&gt;
  &lt;/session-factory&gt;
  </code></pre>
  
  <p></p>
  
  <p>The VwPersoneelslid.hbm.xml looks like:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"&gt;
  &lt;!-- Generated 9-aug-2013 10:13:31 by Hibernate Tools 4.0.0 --&gt;
  &lt;hibernate-mapping&gt;
  &lt;class name="be.comp.model.db.VwPersoneelslid" table="VW_PERSONEELSLID"&gt;
      &lt;composite-id name="id" class="be.comp.model.db.VwPersoneelslidId"&gt;
          &lt;key-property name="pkVwPersoneelslid" type="double"&gt;
              &lt;column name="PK_VW_PERSONEELSLID" precision="126" scale="0" /&gt;
          &lt;/key-property&gt;
          &lt;key-property name="fkVwFunctie" type="double"&gt;
              &lt;column name="FK_VW_FUNCTIE" precision="126" scale="0" /&gt;
          &lt;/key-property&gt;
          &lt;key-property name="familienaam" type="string"&gt;
              &lt;column name="FAMILIENAAM" length="80" /&gt;
          &lt;/key-property&gt;
          &lt;key-property name="voornaam" type="string"&gt;
              &lt;column name="VOORNAAM" length="80" /&gt;
          &lt;/key-property&gt;
          &lt;key-property name="code" type="string"&gt;
              &lt;column name="CODE" length="10" /&gt;
          &lt;/key-property&gt;
  
      &lt;/composite-id&gt;
  &lt;/class&gt;
  </code></pre>
  
  <p></p>
  
  <p>The function with the query is:</p>
  
  <pre><code>public List&lt;VwPersoneelslid&gt; findByCode(String code)
  {
      Session session = HibernateUtil.getSessionFactoryNeptunus().getCurrentSession();
      session.beginTransaction();
  
      List&lt;VwPersoneelslid&gt; list = new ArrayList();
  
      Query query = session.createQuery("FROM VwPersoneelslid WHERE code = :code"); 
      query.setParameter("code", code);
      list = query.list();
  
      session.getTransaction().commit();
  
      return list;
  }
  </code></pre>
  
  <p>The function transformed to native SQL:</p>
  
  <pre><code>public List&lt;VwPersoneelslid&gt; findByCode(String code)
  {
      Session session = HibernateUtil.getSessionFactoryNeptunus().getCurrentSession();
      session.beginTransaction();
  
      List&lt;VwPersoneelslid&gt; list = new ArrayList();
  
      Query query = session.createSQLQuery("SELECT * FROM CIPALII.VW_PERSONEELSLID WHERE code = :code").addEntity(VwPersoneelslid.class)
              .setParameter("code", code);
  
      list = query.list();
  
      session.getTransaction().commit();
  
      return list;
  }
  </code></pre>
  
  <p>If you guys need more information in order to know what might be the problem, please let me know and I add more code. The VwPersoneelslid.hbm.xml file is auto generated by Eclipse. Thanks.</p>