title: JPA native query returns Double or BigDecimal
body: <p>I have the simple code below:</p>
  
  <pre><code>@PersistenceContext(name = "mycontext")
  private EntityManager entityManager;
  
  public void getAggregatePower() {
  
      String sqlString = "SELECT SUM(power) FROM mytable";
      Object singleResult = entityManager.createNativeQuery(sqlString).getSingleResult();
      System.out.println(singleResult.getClass().getName());
  
  }
  </code></pre>
  
  <p>When I run this in a real environment, the print instructions prints <code>java.math.BigDecimal</code>. But when I run this in my unit tests environment, the print instructions prints <code>java.lang.Double</code>.<br>
  In both cases I use a WildFly 9 server and a Postgresql 9.4 database. I also use Arquillian for unit tests. For me, the only noticeable difference is the number of records in database.<br>
  The <code>power</code> column in <code>mytable</code> table is a <code>numeric(10,3)</code>.</p>
  
  <p>I would like to avoid ugly code such as:</p>
  
  <pre><code>if (singleResult instance of Double) {
      ...
  } else if (singleResult instance of BigDecimal) {
      ...
  }
  </code></pre>
  
  <p>Is there a way to always have the same instance no matter my running environment ?</p>