0

I use Java, Spring Boot, CrudRepository and Postgresql.

How can set the isolation level in a CRUD Repo in Spring Boot or how can I set the isolation level in whole Spring Boot application.

Mirko Ebert
  • 1,349
  • 1
  • 18
  • 36
  • Read [this](https://docs.spring.io/spring/docs/4.2.x/spring-framework-reference/html/transaction.html) please. It works the same way in Boot and non-Boot Spring applications. – rustyx Mar 22 '19 at 09:22

1 Answers1

1

Spring creates proxies for all the classes annotated with @Transactional – either on the class or on any of the methods. The proxy allows the framework to inject transactional logic before and after the method being invoked – mainly for starting and committing the transaction.

If the transactional bean is implementing an interface, by default the proxy will be a Java Dynamic Proxy. This means that only external method calls that come in through the proxy will be intercepted – any self-invocation calls will not start any transaction – even if the method is annotated with @Transactional.


Isolation:

DEFAULT: Use the default isolation level of the underlying database.

Read Uncommitted: Allows dirty reads

Read Committed: Does not allow dirty reads

Repeatable Read: If a row is read twice in the same transaction, the result will always be the same

Serializable: Performs all transactions in a sequence

enter image description here

You should refer this Question for more Details.

For Overview Here Here Here

Romil Patel
  • 12,879
  • 7
  • 47
  • 76