title: Does the JPQL avg aggregate function work with Integers?
body: <p>I have a JPA 2 Entity named <em>Surgery</em>.  It has a member named <em>transfusionUnits</em> that is an <em>Integer</em>.</p>
  
  <p>There are two entries in the database.  Executing this JPQL statement:</p>
  
  <pre><code>Select s.transfusionUnits from Surgery s
  </code></pre>
  
  <p>produces the expected result:</p>
  
  <pre><code>2
  3
  </code></pre>
  
  <p>The following statement produces the expected answer of <strong>5</strong>:</p>
  
  <pre><code>Select sum(s.transfusionUnits) from Surgery s
  </code></pre>
  
  <p>I expect the answer of the following statement to be <strong>2.5</strong>, but it returns <strong>2.0</strong> instead.</p>
  
  <pre><code>Select avg(s.transfusionUnits) from Surgery s
  </code></pre>
  
  <p>If I execute the statement on a different (Float) member, the result is correct.  Any ideas on why this is happening?  Do I need to do some sort of cast in JPQL? Is this even possible?  Surely I am missing something trivial here.</p>