The hibernate named query returns a BigDecimal for a column that has datatype NUMBER.
select col1 as "col1" from table1 union select col2 as "col1" from table2
On client side, I expect the datatype of col1 to be long (primitive) I do this:
<return-scalar column="col1" type="java.lang.Long" />
or
<return-scalar column="col1" type="long" />
In both cases, I get :
java.lang.ClassCastException: java.math.BigDecimal incompatible with java.lang.Long
How can I fix this? My suspiscion, something wrong with the aliasing?
Oracle NUMBER maps to BigDecimal in Hibernate by default. Try setting the type to BigDecimal.