Hi,
I am using Hibernate 3.0 with Oracle as my database and have a hard requirement like
I need to populate a table say XYZ, which has a column receiptNumber.
The hard requirement is that for each row, in the table the receiptNumber steadily incrementing BUT WITH NO MISSES allowed
In other words suppose the table has records, with receiptNumber say,
10001,
10002,
10004 (note 10003 has been missed ... a not acceptable situation)
For this initially I had thought of using a a sequence to generate the receiptNumber but in case of exceptions it is possible the sequence increments but no data gets inserted (leading to the missing number situation)
So my DBA suggested, a PL/SQL procedure, in which a number will selected from a table via
select rNumber from rcptNumber_TAB
for update
--followed by
insert into table XYZ
insert
rNumber + 1 into rcptNumber_TAB
commit
This way their will be NO misses in the incrementing rcpt Number inserted.
Could the above be achieved exclusively using
java + hibernate and no PL/SQL?
Any ideas will be appreciated.
thank you.
Jeevan