Hibernate returns BigIntegers instead of longs
The default for ".list()" in hibernate appears to be BigInteger return types for Numeric. Here's one work around:
session.createSQLQuery("select column as num from table")
.addScalar("num", StandardBasicTypes.LONG).list();
In older versions of Hibernate you can use
session.createSQLQuery("select column as num from table")
.addScalar("num", Hibernate.LONG).list();