Java 如何从spring数据jpa应用程序中完全禁用锁定

Java 如何从spring数据jpa应用程序中完全禁用锁定,java,spring-boot,hibernate,spring-data-jpa,pessimistic-locking,Java,Spring Boot,Hibernate,Spring Data Jpa,Pessimistic Locking,在我的项目中,由于我的业务需求,很多表都在不断更新 我在我的MYSQL数据库中设置了readuncommitted隔离级别 但有时我会在应用程序中的不同位置遇到此异常 org.springframework.dao.PessimisticLockingFailureException: could not execute batch; SQL [update test_item set test_name=null where permission_id=? and draft_id=?];

在我的项目中,由于我的业务需求,很多表都在不断更新

我在我的
MYSQL
数据库中设置了
readuncommitted
隔离级别

但有时我会在应用程序中的不同位置遇到此异常

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)
虽然我还没有在我的应用程序中进行任何
锁定的配置

但它仍然失败于我不想要的
悲观锁

在我的应用程序中根本不需要
锁定
,目前数据完整性对我来说很好


请告诉我如何摆脱
锁定

您使用的是InnoDb还是MyISAM引擎?@FabienMIFSUD Innodbd您是否查看了此处:您正在运行哪些sql查询?在不同的事务中,“我(认为我)根本不需要锁定”和“数据库根本不需要锁定”是两件不同的事情。数据库将防止数据损坏,即使允许脏读,数据库也不会执行“损坏写入”。我投票结束这个问题,因为它基于对数据库工作方式的误解,并假设您可以“关闭”锁定。