Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hibernate 表中具有并发更新的弹簧锁超时_Hibernate_Jpa_Concurrency_Spring Boot_H2 - Fatal编程技术网

Hibernate 表中具有并发更新的弹簧锁超时

Hibernate 表中具有并发更新的弹簧锁超时,hibernate,jpa,concurrency,spring-boot,h2,Hibernate,Jpa,Concurrency,Spring Boot,H2,我正在使用spring boot、hibernate、JPA存储库和事件驱动应用程序的反应器开发一个Web服务。 我已经设置了一组并行运行的长作业,我一直在尝试解决由此异常流引起的错误: Could not execute statement; SQL [n/a]; nested exception is org.hibernate.PessimisticLockException: could not execute statement org.springframework.dao.Pess

我正在使用spring boot、hibernate、JPA存储库和事件驱动应用程序的反应器开发一个Web服务。 我已经设置了一组并行运行的长作业,我一直在尝试解决由此异常流引起的错误:

Could not execute statement; SQL [n/a]; nested exception is org.hibernate.PessimisticLockException: could not execute statement
org.springframework.dao.PessimisticLockingFailureException: could not execute statement; SQL [n/a];nested exception is org.hibernate.PessimisticLockException: could not execute statement
...
Caused by: org.hibernate.PessimisticLockException: could not execute statement
...
Caused by: org.h2.jdbc.JdbcSQLException: Timeout trying to lock table ; SQL statement: update 
...
Caused by: org.h2.jdbc.JdbcSQLException: Concurrent update in table "INTERACTIVE_EXPERIMENT": another transaction has updated or deleted the same row [90131-191]
...
Caused by: reactor.core.support.Exceptions$ValueCause: Exception while signaling value: reactor.bus.Event.class : Event{id=null, headers=null, replyTo=null, key=channel2, data=InteractiveExperiment(id=60, instanceName=myJson, simulationsManager=it.polimi.diceH2020.launcher.model.SimulationsWIManager@2a074bbd, simType=WI, thinkTime=10000, numUsers=1, numVMs=1, responseTime=0.0, gamma=null, provider=, numSolutions=0, iter=3, experimentalDuration=0, state=error, done=false)}
我得到“表中的并发更新”交互式_实验:另一个事务更新或删除了同一行,我有并发更新,但它们都在不同的行上! (但它们有一个共同的@manytone字段)

我尝试过乐观和悲观的锁,但都没有解决这个问题。
通过几个并发更新,我得到了这个错误。

现在我已经通过同步更新并设置MVCC=true解决了这个问题