-->
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: Generator Select issue
PostPosted: Fri Oct 02, 2009 10:07 am 
Newbie

Joined: Fri Oct 02, 2009 9:52 am
Posts: 2
Hi,
I am using hibernate 3.1.3 and I want to use the generator class select option. But i get a
ClassCastException - java.lang.String incompatible with java.lang.Integer
The DB is DB2 on Z/oS v9 and the hibernate cfg that i have written contains -
<id name="elearningFilesSID" type="java.lang.Integer" column="ELEARNING_FILES_SID">
<generator class="select"> <param name="key">fileName</param> </generator>
</id>
in DB ELEARNING_FILES_SID is Integer and FILE_NAME is VARCHAR
In the table the column ELEARNING_FILES_SID is a IDENTITY column whose value is generated by DB2, and in the code i have check,before this insert, which will not let the fileName (DB col - FILE_NAME) field to be duplicated. So if i try to fetch using the fileName I would always get the unique ELEARNING_FILES_SID whihc is PK.

I had read somewhere on google search that hibernate contains an error and that the type of the key field should be the same as the type of the ID/PK field (ie both be integer/string). Though there are some refrences that say that this issue has been fixed.

Does any here have faced the same issue and have been able to solve it ? What is version of hibernate that i should use for this issue? DO i need to recreate all hbm files if i change the version of hibernate?


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.