Hibernate does not generate the primary key based on the Oracle sequence specified in the mapping file. The sql shows Hibernate is reading the nextval of the sequence, but the database primary column is not the same value. Is it a bug?
Here is some detailed information:
1) I use hibernate-2.1rc1.zip
2) my mapping:
<id
name="userCompanyId"
type="long"
column="USER_COMPANY_ID"
unsaved-value="0"
>
<generator class="sequence">
<param name="sequence">SQ_USER_COMPANY</param>
</generator>
</id>
3) sql shows:
Hibernate: select SQ_USER_COMPANY.nextval from dual
userCompanyId = 9
Hibernate: insert into USER_COMPANY (DESCRIPTION, IS_PROVIDER, ABBREVIATION, ROW_VERSION, UPDATED_BY, UPDATED_DT, USER_COMPANY_ID) values (?, ?, ?, ?, ?, ?, ?)
4) database value is: 3.7E-51 for USER_COMPANY_ID (NUMBER(15), not 9
What is going on there? any help will be greatly appreciated?
|