-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Mapping long to BIGINT, MySQL 5 InnoDB Dialect, Hib 3.2.5
PostPosted: Thu Apr 03, 2008 11:18 am 
Regular
Regular

Joined: Sun Sep 26, 2004 9:27 pm
Posts: 75
Location: Atlanta, GA, USA
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.