title: hibernate returning BigDecimal datatype instead of long
body: <p>The hibernate named query  returns a BigDecimal for a column that has datatype NUMBER.</p>
  
  <pre><code>select col1 as "col1" from table1 union select col2 as "col1" from table2
  </code></pre>
  
  <p>On client side, I expect the datatype of col1 to be long (primitive)
  I do this:</p>
  
  <pre><code>&lt;return-scalar column="col1" type="java.lang.Long" /&gt;
  </code></pre>
  
  <p>or </p>
  
  <pre><code>&lt;return-scalar column="col1" type="long" /&gt;
  </code></pre>
  
  <p>In both cases, I get :  </p>
  
  <pre><code>java.lang.ClassCastException: java.math.BigDecimal incompatible with java.lang.Long
  </code></pre>
  
  <p>How can I fix this? My suspiscion, something wrong with the aliasing?</p>