New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle.begin() must be explicitly called in transaction #2491
Comments
It is not necessary to mix |
it is a good call that we should not silently error out if someone calls commit or rollback without a begin first. The main purpose of calling "begin" is to turn off autocommit if it was set. I will put a test together from the example code above that test the pre and post 3.41.1 behavior. |
If a handle is by default using autocommit == false, then transactions could be commited (or rolled back) without having to call Handle#begin() first. This broke in 3.41.1. Restore the old behavior. Fixes jdbi#2491
If a handle is by default using autocommit == false, then transactions could be commited (or rolled back) without having to call Handle#begin() first. This broke in 3.41.1. Restore the old behavior. Fixes jdbi#2491
On the latest version (
3.41.1
), ifautocommit
is disabled, you need to explicitly callhandle.begin()
before any insert/update/delete to make any changes. If not, it silently exits without making any changes.Not sure if it was an intended change or if the previous behaviour was wrong, but it wasn't clear from the release notes or documentation that this would be needed.
Example:
Running the above code on
3.41.0
, will insert into DB.Running the above code on
3.41.1
, will not insert into DB.To fix the above on
3.41.1
you would need to addhandle.begin()
:From what I found, this might be caused by the new logic around
handlerState
property added in theBoundLocalTransactionHandler
implementation (#2479).The text was updated successfully, but these errors were encountered: