Hello,
I am very new to hibernate and am having a problem with using the identity generator with DB2 V7.2. After creating a new object and passing it to saveOrUpdate I believe hibernate is supposed to save the new id value for the newly created row in the database in that property. This does not occur however, it just sets it to zero. I believe it is having problems retrieving the Identity value for the new entry. From the debug output below it appears to call some function IDENTITY_VAL_LOCAL to get the identity value but that just returns 0. The last line is a call to getID after saveorupdate has been called from the driving program. I have changed it over to use a sequence instead and it is now working. Has anyone else encountered the same problem or know what I might be doing wrong ? Thanks in advance for your help!
Thanks,
Eric
--Debug output --
14:07:02,160 DEBUG [BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
14:07:02,160 DEBUG [SessionFactoryImpl] prepared statement get: insert into BaseDataObject (type, id) values (?, default)
14:07:02,160 DEBUG [SessionFactoryImpl] preparing statement
14:07:02,160 DEBUG [StringType] binding 'HelloWorld1' to parameter: 1
14:07:02,160 DEBUG [BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
14:07:02,160 DEBUG [SessionFactoryImpl] closing statement
14:07:02,160 DEBUG [BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
14:07:02,160 DEBUG [SessionFactoryImpl] prepared statement get: values IDENTITY_VAL_LOCAL()
14:07:02,160 DEBUG [SessionFactoryImpl] preparing statement
14:07:02,160 DEBUG [NormalizedEntityPersister] Natively generated identity: 0
14:07:02,160 DEBUG [BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
14:07:02,160 DEBUG [SessionFactoryImpl] closing statement
14:07:02,160 DEBUG [Cascades] processing cascades for: edu.jhu.ccbm.pathway.data.BaseDataObject
14:07:02,175 DEBUG [Cascades] done processing cascades for: edu.jhu.ccbm.pathway.data.BaseDataObject
14:07:02,175 DEBUG [HibernateTestServlet] 0
|