I have an application that uses hibernate version 3.6.4, and c3p0 version 0.9.1.2 for connection pooling. My underlying RDBMS is MySql version 5.0.67.
My installation of MySql indicates that the default transaction isolation level is "REPEATABLE-READ" (4):
mysql> select @@GLOBAL.tx_isolation, @@tx_isolation;
+-----------------------+-----------------+
| @@GLOBAL.tx_isolation | @@tx_isolation |
+-----------------------+-----------------+
| REPEATABLE-READ | REPEATABLE-READ |
+-----------------------+-----------------+
I have not changed or configured the transaction isolation level within hibernate.cfg.xml or anywhere within my application. From the app, I use the following code to print configuration:
DatabaseMetaData meta = getSession().connection().getMetaData();
System.out.println("Default Tx Isolation: " + meta.getDefaultTransactionIsolation());
System.out.println("Current Tx Isolation: " + getSession().connection().getTransactionIsolation());
And I get the following results:
Default Tx Isolation: 2 (=READ_COMMITTED)
Current Tx Isolation: 4 (=REPEATABLE_READ)
So, my questions are the following:
looks like meta.getDefaultTransactionIsolation()); is hardcoded in the implementation of DatabaseMetaData in the mysql driver
public class DatabaseMetaData implements java.sql.DatabaseMetaData lines....
1475 public int getDefaultTransactionIsolation() throws java.sql.SQLException JavaDoc { 1476 if (this.conn.supportsIsolationLevel()) { 1477 return java.sql.Connection.TRANSACTION_READ_COMMITTED; 1478 } else { 1479 return java.sql.Connection.TRANSACTION_NONE; 1480 } 1481 }
so i'd bet and trust getSession().connection().getTransactionIsolation()