I have created a database transaction and I am inserting records in Table1
of H2
DB. But no commits done yet.
In between this process, after executing half of the records, I execute one create
statement(created Table2).
Table2
is created and along with it, previous INSERT
statements are also getting committed in DB.
After this, I'm inserting more records in Table1
, if there is a failure in insertion, I still see records in Table1 which were inserted before create
statement for Table2
.
Due to this, I see some records in DB even after transaction failure. I was expecting ZERO records in DB.
Why is this happening?