javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not extract ResultSet
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:200)
at org.hibernate.internal.SessionImpl.refresh(SessionImpl.java:3671)
at org.hibernate.test.jpa.lock.LockExceptionTests.lambda$null$5(LockExceptionTests.java:111)
at org.hibernate.testing.transaction.TransactionUtil2.inTransaction(TransactionUtil2.java:81)
at org.hibernate.testing.transaction.TransactionUtil2.lambda$inTransaction$0(TransactionUtil2.java:61)
at org.hibernate.testing.transaction.TransactionUtil2.inSession(TransactionUtil2.java:35)
at org.hibernate.testing.transaction.TransactionUtil2.inTransaction(TransactionUtil2.java:59)
at org.hibernate.test.jpa.lock.LockExceptionTests.lambda$testLockTimeoutRefresh$6(LockExceptionTests.java:105)
at org.hibernate.testing.transaction.TransactionUtil2.inTransaction(TransactionUtil2.java:81)
at org.hibernate.testing.transaction.TransactionUtil2.lambda$inTransaction$0(TransactionUtil2.java:61)
at org.hibernate.testing.transaction.TransactionUtil2.inSession(TransactionUtil2.java:35)
at org.hibernate.testing.transaction.TransactionUtil2.inTransaction(TransactionUtil2.java:59)
at org.hibernate.testing.junit4.BaseCoreFunctionalTestCase.inTransaction(BaseCoreFunctionalTestCase.java:511)
at org.hibernate.test.jpa.lock.LockExceptionTests.testLockTimeoutRefresh(LockExceptionTests.java:101)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.hibernate.exception.GenericJDBCException: could not extract ResultSet
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:69)
at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.getResultSet(AbstractLoadPlanBasedLoader.java:400)
at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeQueryStatement(AbstractLoadPlanBasedLoader.java:172)
at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:106)
at org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader.load(AbstractLoadPlanBasedEntityLoader.java:188)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:4289)
at org.hibernate.event.internal.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:205)
at org.hibernate.event.internal.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:48)
at org.hibernate.internal.SessionImpl.fireRefresh(SessionImpl.java:1356)
at org.hibernate.internal.SessionImpl.refresh(SessionImpl.java:1331)
at org.hibernate.internal.SessionImpl.refresh(SessionImpl.java:1325)
at org.hibernate.internal.SessionImpl.refresh(SessionImpl.java:3661)
... 27 more
Caused by: java.sql.SQLException: Statement aborted because lock(s) could not be acquired immediately and NOWAIT is set.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1003)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:60)
... 38 more
Looking at test it seems to me that error is expected, but SQLException isn't converted to expected exception.
Details from SQLException: Error code: 3572 SQL State: HY000