Hi, 1) Assume I'm inserting 100 rows successfully. Based on earlier group > threads getGeneratedKeys only will return the key for record 100. So > I'll need to query the database after the executeBatch to get the list > of Ids created? >
Yes. 2) Assume row 14 of the above has a constraint violation so it can't > be inserted. Does the insert stop at row 14 or continue until row 100 > but the return array has a zero in position 14 to indicate that it > didn't get inserted? Yes, H2 will continue. It will throw a BatchUpdateException with Statement.EXECUTE_FAILED in the given element. If there is no exception, it will return an array of update counts. > Do we get an exception but the there rows are > inserted Yes, if autocommit is enabled. > or do we not get an exception and we need to always check the > returned array of modified rows? > No need to check the 3) If the insert stops above in example 2 - how do we recover? do we > need to rebuild the entire batch again starting from row 15? > It depends on what you want to do. Regards, Thomas -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
