Hi, Hm, I think you are right. With autocommit enabled, I think there could be gaps.
Of course there are workarounds, for example using a single statement of the form "insert into ... values (?, ?), (?, ?), (?, ?)". For H2, that would be faster than using batch inserts, and it is one transaction. Or disabling autocommit. But for batch inserts (addBatch / executeBatch), with autocommit, a change would be needed. Patches are welcome! Regards, Thomas On Friday, June 12, 2015, iJava <[email protected]> wrote: > Thank you very much for your answer. Yes, I insert without gaps. Yes, I > can calculate from last ID and and in reverse order to find out all the > previous id. > > However, this solution will work only with two conditions: > 1)When H2 is a server and there are other clients who make inserts but my > multiple insert 100% will have ids without gaps. > Example I insert four elements. The following is ok: 4,5,6,7. The > following example is not ok:4,6,7,8 - another client inserted with id=5. > 2) The order of elements in multiple insert query = the order sql engine > insert them in DB. > > Could you comment these two conditions? > > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <javascript:_e(%7B%7D,'cvml','h2-database%[email protected]');> > . > To post to this group, send email to [email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');>. > Visit this group at http://groups.google.com/group/h2-database. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
