Warning: JPA does not support custom isolation levels, so locks may not be taken when launching Jobs

Viewed 4624

During startup of my application (Spring Boot, Spring Data JPA, Spring Batch, Postgres DB) I get such warning:

2020-03-04 11:53:24.559  WARN [-,,,] 25743 --- [           main] o.s.b.a.batch.JpaBatchConfigurer         : JPA does not support custom isolation levels, so locks may not be taken when launching Jobs

I did some research on spring boot isolation levels, we have: DEFAULT, READ_COMMITTED, READ_UNCOMMITTED, REPEATABLE_READ and SERIALIZABLE.

From warning I understand that JPA does not support that, but just use DEFAULT for given DB, in my case, for Postgres is READ_COMMITTED.

Also I have read that default isolation level of Spring batch transactions is SERIALIZABLE to prevent the same job instance being executed concurrently.

Can someone explain me, when should I will be worried about this warning? I don't know if I should do something about it.

1 Answers

READ_COMMITTED should work fine with Postgers. From the Transaction Configuration for the JobRepository section of Spring Batch docs:

The default isolation level for that method is SERIALIZABLE, which is quite aggressive: READ_COMMITTED would work just as well

So I believe this warning is safe to ignore.

Related