2014-04-17 7:21 GMT-03:00 Esteban Lorenzano <[email protected]>: > but I’m with Sven here, you should use sequences (unless there is something > that prevents you to do it… ?).
I know about sequences and use them for other purposes. But in this case the sequence is not affected by the transaction, so if for any reason I have to rollback the creation of a new document, the number of the sequence will remain ahead. Marten's proposal, on the other hand, is closer, if not exactly to what I need. Because it moves the control back to the image, where I like to be. :) Think of invoices, I must have a consecutive set of invoices, like 0001, 0002, 0003, there can't be gaps in between. In the past I did this without considering concurrency, and had only a few issues in thousands of transactions, but the app wasn't web, nor receiving input from several clients at the same tame. Thanks!
