Preconditions
- Hikari connection pool
- Oracle database
- Default isolation level (read-commited)
- setAutocomplete(false)
- Our connection from the pool has already been used for some queries (it's not new)
The question
When does the next transaction start?
- right after the previous commit
- on any first request after the previous commit (even if it's a select statement)
- on the first change request after the previous commit (like, update, delete, insert)
- something else ?
CodePudding user response:
An Oracle database transaction starts with the SQL DML command (insert/update/delete) and ends with a commit or a rollback (which rolls back to the most recent commit). A select may read the result of a transaction - committed or uncommitted - but is not part of the transaction itself. There is nothing to do in Java to explicitly open or close a transaction; the transaction is defined only within a session and SQL commands in the database.