Skip to content

feat: 비관적 락 제거 및 로그 추가 #55

feat: 비관적 락 제거 및 로그 추가

feat: 비관적 락 제거 및 로그 추가 #55

GitHub Actions / JUnit Test Report failed Nov 12, 2024 in 0s

201 tests run, 200 passed, 0 skipped, 1 failed.

Annotations

Check failure on line 132 in src/test/java/com/potatocake/everymoment/repository/MemberRepositoryTest.java

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

MemberRepositoryTest.다음 익명 회원 번호가 성공적으로 생성된다.

org.springframework.dao.InvalidDataAccessResourceUsageException: could not prepare statement [FOR UPDATE is not allowed in DISTINCT or grouped select; SQL statement:
SELECT CASE WHEN MIN(m.number) > 0 OR MIN(m.number) IS NULL THEN -1 ELSE MIN(m.number) - 1 END FROM member m WHERE m.deleted = 0 FOR UPDATE [90145-224]] [SELECT CASE WHEN MIN(m.number) > 0 OR MIN(m.number) IS NULL THEN -1 ELSE MIN(m.number) - 1 END FROM member m WHERE m.deleted = 0 FOR UPDATE]; SQL [SELECT CASE WHEN MIN(m.number) > 0 OR MIN(m.number) IS NULL THEN -1 ELSE MIN(m.number) - 1 END FROM member m WHERE m.deleted = 0 FOR UPDATE]
Raw output
org.springframework.dao.InvalidDataAccessResourceUsageException: could not prepare statement [FOR UPDATE is not allowed in DISTINCT or grouped select; SQL statement:
SELECT CASE WHEN MIN(m.number) > 0 OR MIN(m.number) IS NULL THEN -1 ELSE MIN(m.number) - 1 END FROM member m WHERE m.deleted = 0 FOR UPDATE [90145-224]] [SELECT CASE WHEN MIN(m.number) > 0 OR MIN(m.number) IS NULL THEN -1 ELSE MIN(m.number) - 1 END FROM member m WHERE m.deleted = 0 FOR UPDATE]; SQL [SELECT CASE WHEN MIN(m.number) > 0 OR MIN(m.number) IS NULL THEN -1 ELSE MIN(m.number) - 1 END FROM member m WHERE m.deleted = 0 FOR UPDATE]
	at app//org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:277)
	at app//org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:241)
	at app//org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:550)
	at app//org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
	at app//org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:335)
	at app//org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:160)
	at app//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at app//org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:136)
	at app//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at app//org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
	at app//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at app//org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:223)
	at app/jdk.proxy3/jdk.proxy3.$Proxy181.findNextAnonymousNumber(Unknown Source)
	at app//com.potatocake.everymoment.repository.MemberRepositoryTest.should_GenerateNextNumber_When_CreatingAnonymous(MemberRepositoryTest.java:132)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:580)
	at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1596)
	at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: org.hibernate.exception.SQLGrammarException: could not prepare statement [FOR UPDATE is not allowed in DISTINCT or grouped select; SQL statement:
SELECT CASE WHEN MIN(m.number) > 0 OR MIN(m.number) IS NULL THEN -1 ELSE MIN(m.number) - 1 END FROM member m WHERE m.deleted = 0 FOR UPDATE [90145-224]] [SELECT CASE WHEN MIN(m.number) > 0 OR MIN(m.number) IS NULL THEN -1 ELSE MIN(m.number) - 1 END FROM member m WHERE m.deleted = 0 FOR UPDATE]
	at app//org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:66)
	at app//org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:58)
	at app//org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:108)
	at app//org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:194)
	at app//org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:155)
	at app//org.hibernate.sql.exec.spi.JdbcSelectExecutor.lambda$list$0(JdbcSelectExecutor.java:85)
	at app//org.hibernate.sql.results.jdbc.internal.DeferredResultSetAccess.executeQuery(DeferredResultSetAccess.java:231)
	at app//org.hibernate.sql.results.jdbc.internal.DeferredResultSetAccess.getResultSet(DeferredResultSetAccess.java:167)
	at app//org.hibernate.sql.results.jdbc.internal.AbstractResultSetAccess.getMetaData(AbstractResultSetAccess.java:36)
	at app//org.hibernate.sql.results.jdbc.internal.AbstractResultSetAccess.getColumnCount(AbstractResultSetAccess.java:52)
	at app//org.hibernate.query.results.ResultSetMappingImpl.resolve(ResultSetMappingImpl.java:193)
	at app//org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.resolveJdbcValuesSource(JdbcSelectExecutorStandardImpl.java:327)
	at app//org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.doExecuteQuery(JdbcSelectExecutorStandardImpl.java:115)
	at app//org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.executeQuery(JdbcSelectExecutorStandardImpl.java:83)
	at app//org.hibernate.sql.exec.spi.JdbcSelectExecutor.list(JdbcSelectExecutor.java:76)
	at app//org.hibernate.sql.exec.spi.JdbcSelectExecutor.list(JdbcSelectExecutor.java:65)
	at app//org.hibernate.query.sql.internal.NativeSelectQueryPlanImpl.performList(NativeSelectQueryPlanImpl.java:138)
	at app//org.hibernate.query.sql.internal.NativeQueryImpl.doList(NativeQueryImpl.java:628)
	at app//org.hibernate.query.spi.AbstractSelectionQuery.list(AbstractSelectionQuery.java:423)
	at app//org.hibernate.query.spi.AbstractSelectionQuery.getSingleResult(AbstractSelectionQuery.java:555)
	at app//org.springframework.data.jpa.repository.query.JpaQueryExecution$SingleEntityExecution.doExecute(JpaQueryExecution.java:223)
	at app//org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:92)
	at app//org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:152)
	at app//org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:140)
	at app//org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:170)
	at app//org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:158)
	at app//org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:169)
	at app//org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:148)
	at app//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at app//org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:70)
	at app//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at app//org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:379)
	at app//org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
	at app//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at app//org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138)
	... 11 more
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: FOR UPDATE is not allowed in DISTINCT or grouped select; SQL statement:
SELECT CASE WHEN MIN(m.number) > 0 OR MIN(m.number) IS NULL THEN -1 ELSE MIN(m.number) - 1 END FROM member m WHERE m.deleted = 0 FOR UPDATE [90145-224]
	at app//org.h2.message.DbException.getJdbcSQLException(DbException.java:644)
	at app//org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
	at app//org.h2.message.DbException.get(DbException.java:223)
	at app//org.h2.message.DbException.get(DbException.java:199)
	at app//org.h2.message.DbException.get(DbException.java:188)
	at app//org.h2.command.query.Select.setForUpdate(Select.java:1550)
	at app//org.h2.command.Parser.parseEndOfQuery(Parser.java:2670)
	at app//org.h2.command.Parser.parseQueryExpressionBodyAndEndOfQuery(Parser.java:2537)
	at app//org.h2.command.Parser.parseQueryExpression(Parser.java:2529)
	at app//org.h2.command.Parser.parseQuery(Parser.java:2498)
	at app//org.h2.command.Parser.parsePrepared(Parser.java:627)
	at app//org.h2.command.Parser.parse(Parser.java:592)
	at app//org.h2.command.Parser.parse(Parser.java:564)
	at app//org.h2.command.Parser.prepareCommand(Parser.java:483)
	at app//org.h2.engine.SessionLocal.prepareLocal(SessionLocal.java:639)
	at app//org.h2.engine.SessionLocal.prepareCommand(SessionLocal.java:559)
	at app//org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1166)
	at app//org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:93)
	at app//org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:316)
	at app//org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:153)
	at app//org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:183)
	... 42 more