Using Hibernate 3.2.5, a few of my primary keys are Java longs. My SQL schema has these created as BIGINT UNSIGNED.
Whenever I do a query on these keys alone, they are being returned as Big Integer types, and a ClassCastException is being thrown. For example:
(The following is not real code; I don't have my SQL embedded in my tests.)
Code:
List<Long> keysList = session.createSQLQuery("select id from UserAccount") .list() ;
Assert.assertEquals(keysList.get(0).getClass(), Long.class) ;
A list of BigInteger objects is returned instead.
I'm quite comfortable with over-riding the MySQL 5 InnoDB dialect, but I can't seem to figure out how this is supposed to be done. To be more specific, I don't understand which Type should map to which Hibernate type for the effect I need.
Suggestions?
Lukas