title: Bug in Spring Data JPA: Spring Data returns List<BigInteger> instead of List<Long>
body: <p>I have DAO implementation over spring-data:</p>
  
  <pre><code>public interface TestDataRepository extends CrudRepository&lt;DpConfigData, Long&gt; {
  @Query(value = "select distinct(oid) from unit", nativeQuery = true)
      List&lt;Long&gt; testMethod();
  }
  </code></pre>
  
  <p>And unit test to test menioned DAO:</p>
  
  <pre><code>@Test
  public void test(){
      List&lt;Long&gt; testData = dpConfigDataEntityDataRepository.testMethod();
      for (Long oid:testData){
          System.out.print(oid);
      }
  }
  </code></pre>
  
  <p>Running test give strange result - <code>List&lt;Long&gt; testData</code> in runtime is populated by BigInteger instances, not by Long. As result I get <strong>ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long</strong></p>
  
  <p>JPA implementation - Hibernate.
  As DB I use PostgreSQL, <code>unit.oid</code> field has BigInt type on DB layer.
  It is mapped to Long in case of fetching whole unit, but with custom query as "select distinct ..." something went wrong and it is mapped to BigInteger.</p>
  
  <p>So, my question: what is the cause of such strange behaviour?
  How to solve/workaround it in elegant way?</p>