인프런 커뮤니티 질문&답변

이성현님의 프로필 이미지
이성현

작성한 질문수

스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술

JPA 17분 오류 발생

작성

·

357

0

스크린샷 2024-01-28 오후 10.21.05.png강의 17분에서 통합테스트 돌렸는데 이런 오류가 뜹니다.

어딜 하나 건드려서 지금 오류가 전부 뜨는 것 같은데

클래스가 너무 많아서 어디가 오류인지도 잘 모르겠습니다..

답변 기다리겠습니다.

Hibernate: select m1_0.id,m1_0.name from member m1_0 where m1_0.name=?

2024-01-28T22:17:30.817+09:00 WARN 11685 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 42104, SQLState: 42S04

2024-01-28T22:17:30.817+09:00 ERROR 11685 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : Table "MEMBER" not found (this database is empty); SQL statement:

select m1_0.id,m1_0.name from member m1_0 where m1_0.name=? [42104-214]

org.hibernate.exception.SQLGrammarException: could not prepare statement [Table "MEMBER" not found (this database is empty); SQL statement:

select m1_0.id,m1_0.name from member m1_0 where m1_0.name=? [42104-214]] [select m1_0.id,m1_0.name from member m1_0 where m1_0.name=?]

at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:64)

at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:56)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:108)

at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:187)

at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:76)

at org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.lambda$list$0(JdbcSelectExecutorStandardImpl.java:102)

at org.hibernate.sql.results.jdbc.internal.DeferredResultSetAccess.executeQuery(DeferredResultSetAccess.java:226)

at org.hibernate.sql.results.jdbc.internal.DeferredResultSetAccess.getResultSet(DeferredResultSetAccess.java:163)

at org.hibernate.sql.results.jdbc.internal.JdbcValuesResultSetImpl.advanceNext(JdbcValuesResultSetImpl.java:254)

at org.hibernate.sql.results.jdbc.internal.JdbcValuesResultSetImpl.processNext(JdbcValuesResultSetImpl.java:134)

at org.hibernate.sql.results.jdbc.internal.AbstractJdbcValues.next(AbstractJdbcValues.java:19)

at org.hibernate.sql.results.internal.RowProcessingStateStandardImpl.next(RowProcessingStateStandardImpl.java:66)

at org.hibernate.sql.results.spi.ListResultsConsumer.consume(ListResultsConsumer.java:198)

at org.hibernate.sql.results.spi.ListResultsConsumer.consume(ListResultsConsumer.java:33)

at org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.doExecuteQuery(JdbcSelectExecutorStandardImpl.java:361)

at org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.executeQuery(JdbcSelectExecutorStandardImpl.java:168)

at org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.list(JdbcSelectExecutorStandardImpl.java:93)

at org.hibernate.sql.exec.spi.JdbcSelectExecutor.list(JdbcSelectExecutor.java:31)

at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.lambda$new$0(ConcreteSqmSelectQueryPlan.java:110)

at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.withCacheableSqmInterpretation(ConcreteSqmSelectQueryPlan.java:303)

at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.performList(ConcreteSqmSelectQueryPlan.java:244)

at org.hibernate.query.sqm.internal.QuerySqmImpl.doList(QuerySqmImpl.java:518)

at org.hibernate.query.spi.AbstractSelectionQuery.list(AbstractSelectionQuery.java:367)

at org.hibernate.query.Query.getResultList(Query.java:119)

at hello.hellospring.repository.JpaMemberRepository.findByName(JpaMemberRepository.java:34)

at hello.hellospring.service.MemberService.validateDuplicateMember(MemberService.java:33)

at hello.hellospring.service.MemberService.join(MemberService.java:27)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:568)

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:756)

at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)

at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:391)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:756)

at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708)

at hello.hellospring.service.MemberService$$SpringCGLIB$$0.join(<generated>)

at hello.hellospring.service.MemberServiceIntegrationTest.join(MemberServiceIntegrationTest.java:30)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:568)

at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)

at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)

at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)

at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)

at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)

at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)

at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)

at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)

at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)

at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)

at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)

at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)

at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)

at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)

at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)

at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)

at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)

at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)

 

 

 

 

답변 1

0

안녕하세요. 이성현님, 공식 서포터즈 y2gcoder입니다.

아마도 올려주신 예외만 봤을 때는 데이터베이스에 member 테이블이 존재하지 않아서 에러가 나는 것으로 보입니다. h2 DB를 실행 후 콘솔로 들어가셔서 member 테이블이 존재하는지 체크해보시길 권해드립니다! 존재하지 않는다면 H2 데이터베이스 설치 강의에서 했던대로 다시 member 테이블을 생성해주십쇼!!

image

 

감사합니다.

이성현님의 프로필 이미지
이성현
질문자

해결했습니다 제가 버전 호환때문에 H2 database를 새로 설치했는데 안에 member table을 형성을 안하고 있었어서 그랬네요 ㅠㅠ 감사합니다 ! !

이성현님의 프로필 이미지
이성현

작성한 질문수

질문하기