# How to get the default transaction isolation level using Hibernate API

**URL:** <https://discourse.hibernate.org/t/how-to-get-the-default-transaction-isolation-level-using-hibernate-api/1165>\
**Category:** Hibernate ORM\
**Created:** [August 3, 2018, 12:03pm UTC](https://discourse.hibernate.org/t/how-to-get-the-default-transaction-isolation-level-using-hibernate-api/1165 "2018-08-03T12:03:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pushkar\_Deole](https://avatars.discourse-cdn.com/v4/letter/p/bb73d2/32.png) [@Pushkar\_Deole](https://discourse.hibernate.org/u/Pushkar_Deole)\
**Post date:** [August 3, 2018, 12:03pm UTC](https://discourse.hibernate.org/t/how-to-get-the-default-transaction-isolation-level-using-hibernate-api/1165/1 "2018-08-03T12:03:39Z")

</div>

Can I get default transaction isolation level using Hibernate’s API?

---

<div class="post-metadata">

**Author:** ![vlad](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/vlad/32/658_2.png) [@vlad](https://discourse.hibernate.org/u/vlad)\
**Post date:** [August 7, 2018, 9:16am UTC](https://discourse.hibernate.org/t/how-to-get-the-default-transaction-isolation-level-using-hibernate-api/1165/2 "2018-08-07T09:16:50Z")

</div>

When using Hibernate API:

```auto
int isolationLevel = session.doReturningWork(Connection::getTransactionIsolation);

```

When using JPA:

```auto
int isolationLevel = entityManager.unwrap(Session.class)
	.doReturningWork(Connection::getTransactionIsolation);

```

---

<div class="post-metadata">

**Author:** ![Pushkar\_Deole](https://avatars.discourse-cdn.com/v4/letter/p/bb73d2/32.png) [@Pushkar\_Deole](https://discourse.hibernate.org/u/Pushkar_Deole)\
**Post date:** [August 10, 2018, 3:11pm UTC](https://discourse.hibernate.org/t/how-to-get-the-default-transaction-isolation-level-using-hibernate-api/1165/3 "2018-08-10T15:11:32Z")

</div>

If I don’t set hibernate isolation level through the property then what is the default isolation level used by hibernate?

---

<div class="post-metadata">

**Author:** ![vlad](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/vlad/32/658_2.png) [@vlad](https://discourse.hibernate.org/u/vlad)\
**Post date:** [August 10, 2018, 3:13pm UTC](https://discourse.hibernate.org/t/how-to-get-the-default-transaction-isolation-level-using-hibernate-api/1165/4 "2018-08-10T15:13:25Z")

</div>

Hibernate uses the underlying DB isolation level.

---

<div class="post-metadata">

**Author:** ![Pushkar\_Deole](https://avatars.discourse-cdn.com/v4/letter/p/bb73d2/32.png) [@Pushkar\_Deole](https://discourse.hibernate.org/u/Pushkar_Deole)\
**Post date:** [August 11, 2018, 5:43pm UTC](https://discourse.hibernate.org/t/how-to-get-the-default-transaction-isolation-level-using-hibernate-api/1165/5 "2018-08-11T17:43:12Z")

</div>

Can I override the underlying database isolation level through hibernate? If yes then how?

---

<div class="post-metadata">

**Author:** ![vlad](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/vlad/32/658_2.png) [@vlad](https://discourse.hibernate.org/u/vlad)\
**Post date:** [August 11, 2018, 6:36pm UTC](https://discourse.hibernate.org/t/how-to-get-the-default-transaction-isolation-level-using-hibernate-api/1165/6 "2018-08-11T18:36:35Z")

</div>

It all depends on what connection provider you use. For DataSource ConnectionPprovider, set it at Connection Pool level. For other Connection Providers, just set the `hibernate.connection.isolation` property.
