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?
|