FSP
FSP

Reputation: 4827

transactions in jdbi

I execute sql queries as transactions using jdbi inTransaction() function. I would like to know how/what type of locking mechanism is used internally. additionally, is the whole table locked during the transaction or just the record that has to be updated?

Upvotes: 5

Views: 4361

Answers (3)

Slavkó Medvediev
Slavkó Medvediev

Reputation: 1571

The 2nd part of your question, "...is the whole table locked during the transaction or just the record that has to be updated?", depends on DBMS being used.

Here's, for example, MySQL documentation for table- and row-level locking: https://dev.mysql.com/doc/refman/5.7/en/internal-locking.html

Upvotes: 1

brianm
brianm

Reputation: 2045

The transaction is purely at the database level. It will use the default isolation level for the database/connection unless overridden.

If you are using the inTransaction(...) method which accepts a callback, there is a form of that function which allows for you to set the isolation level:

<ReturnType> ReturnType inTransaction(TransactionIsolationLevel level,
                                      TransactionCallback<ReturnType> callback)

-Brian

Upvotes: 9

Alexandr
Alexandr

Reputation: 9505

It depends on transaction isolation level. Isolation

Upvotes: 0

Related Questions