在我的项目中,由于我的业务需求,许多表不断更新。
我设置的隔离级别 Read Uncommitted
在我的 MYSQL
数据库
但有时我会在应用程序的不同位置遇到这个异常。
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)
虽然我还没有做过任何配置 locking
在我的申请表中
但它还是失败了 pessimistic lock
我不想要。
我不需要 locking
在我的应用程序中,数据完整性目前对我来说还不错。
请告诉我怎样才能摆脱 locking
?
暂无答案!
目前还没有任何答案,快来回答吧!