aspose file tools*
The moose likes Object Relational Mapping and the fly likes SQLException: Invalid value for getInt() + scrambled columns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "SQLException: Invalid value for getInt() + scrambled columns" Watch "SQLException: Invalid value for getInt() + scrambled columns" New topic
Author

SQLException: Invalid value for getInt() + scrambled columns

Karsten Wutzke
Ranch Hand

Joined: Jul 20, 2010
Posts: 106

Hello,

I'm getting more and more frustrated by Hibernate doing unexplainable things. I get the following exception:



The SQL for the table is:


Here's the entity and composite key class:




If you look at the stack trace line



you can see the order of columns is [clubId, ordinalNbr, teamtypeCode] and {teamtypeCode=mo20, clubId=101, ordinalNbr=1}, but the table (I checked the DB x times) and the class are club_id, teamtype_code, ordinalNbr. My suspicion here is that Hibernate scrambles the columns for whatever reason and where expecting club_id (getInt()) it calls that on teamtype_code and excepts... BTW I'm using a simple call to:



What the hell is Hibernate doing? I have no idea. I'm beginning to believe Hiberate is a poor ORM tool, especially when it comes to mappings and composite primary keys.

Does anyone have an idea what to try to fix this?

Karsten


OCJP JavaSE 6 (86%)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQLException: Invalid value for getInt() + scrambled columns