our setup is different, you may want to try this instead. We have our auto-increments set up in the hibernate mapping files. When we execute an INSERT, Hibernate automatically figures out the next key and uses it:
In the classxxx.hbm.xml file, we have:
Code:
<id name="socPatientId"
type="long"
column="SOC_PATIENT_ID">
<generator class="sequence">
<param name="sequence">SOC_PATIENT_ID_SEQ</param>
</generator>
</id>
When executing an insert, Hibernates generates the following SQL:
select SOC_PATIENT_ID_SEQ.nextval from dual
insert into SOC_PATIENT (..., soc_patient_id,...) values (...)