3

We are using Doctrine as ORM, Framework ZF1 and ZF2, and Database MySql. I know the default isolation level for innodb engine is Repeatable Read. Since I am using the Doctrine as ORM what is the default isolation level? In this document it is stated as below:

The default transaction isolation level of a Doctrine\DBAL\Connection is chosen by the underlying platform but it is always at least READ_COMMITTED.

What made me more confused was from the another article from the Doctrine itself. I this document it is stated as follow:

This could result in unpredictable results because an explicit WITH (NOLOCK) table hint tells SQL Server to run a specific query in transaction isolation level READ UNCOMMITTED instead of the default READ COMMITTED transaction isolation level. Therefore there now is a distinction between LockMode::NONE and null to be able to tell Doctrine whether to add table lock hints to queries by intention or not.

Can anyone explain what is the default isolation level for Doctrine?

Bhuwan Gautam
  • 1,229
  • 1
  • 11
  • 24

3 Answers3

0

If you are not sure what the default isolation level is you can set it once and for all with SET TRANSACTION ISOLATION LEVEL.

middlestump
  • 1,035
  • 8
  • 22
0

You can use Doctrine\DBAL\Driver\Connection's getTransactionIsolation() method to determine the active transaction's isolation level.

Andrew C.
  • 36
  • 3
0

For MySql the default isolation level is Repeatable Read.

For MSSql the default isolation level is Read Committed.

Unless you change the default setting of the middleware(ORM) the following statement is valid:

The default transaction isolation level of a Doctrine\DBAL\Connection is chosen by the underlying platform.

Bhuwan Gautam
  • 1,229
  • 1
  • 11
  • 24