In my project due to my business requirement a lot of tables are continuously updated.
Isolation level I have set Read Uncommitted
in my MYSQL
database
but sometimes I get this exception at different different place in the application.
org.springframework.dao.PessimisticLockingFailureException: could not execute batch; SQL
[update test_item set test_name=null where permission_id=? and draft_id=?]; nested exception
is org.hibernate.PessimisticLockException: could not execute batch
at com.test.service.impl.SheetService.reverseSyncTimebaseSheet (SheetService.java:8890)
at com.test.service.impl.SheetService.syncSheet (SheetService.java:8546)
at com.test.controller.SheetController.syncSheetDataBySheetId (SheetController.java:987)
at com.test.security.JwtAuthenticationFilter.doFilterInternal
(JwtAuthenticationFilter.java:55)
Caused by: org.hibernate.PessimisticLockException: could not execute batch
at org.hibernate.dialect.MySQLDialect$3.convert (MySQLDialect.java:531)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert
(StandardSQLExceptionConverter.java:42)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert (SqlExceptionHelper.java:113)
at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution
(BatchingBatch.java:128)
at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.doExecuteBatch
(BatchingBatch.java:104)
at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.execute
(AbstractBatchImpl.java:147)
at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.executeBatch
(JdbcCoordinatorImpl.java:212)
at org.hibernate.engine.spi.ActionQueue.executeActions (ActionQueue.java:633)
at org.hibernate.engine.spi.ActionQueue.executeActions (ActionQueue.java:478)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions
(AbstractFlushingEventListener.java:356)
Although I haven't done any configuration for locking
in my application
but still its failing for pessimistic lock
which I don't want.
I don't need locking
in my application at all , data integrity is fine for me at the moment.
Please let me know how can I get rid of locking
?