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

김수환님의 프로필 이미지
김수환

작성한 질문수

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

JPA

통합 테스트 코드 - 회원가입() 메서드 에러 질문드립니다.

작성

·

1.2K

0

학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.

1. 강의 내용과 관련된 질문을 남겨주세요.
2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.
(자주 하는 질문 링크: https://bit.ly/3fX6ygx)
3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.
(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)

질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.
=========================================
[질문 템플릿]
1. 강의 내용과 관련된 질문인가요? (예/아니오)
2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)
3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)

[질문 내용]
16:47초에 실행하시는 통합테스트 코드 - 회원가입() 메서드 실행에서 에러가 납니다..

 

에러 내용은 다음과 같습니다.

could not prepare statement [Column "M1_0.USERNAME" not found; SQL statement:

select m1_0.id,m1_0.username from member m1_0 where m1_0.username=? [42122-214]] [select m1_0.id,m1_0.username from member m1_0 where m1_0.username=?]

org.hibernate.exception.SQLGrammarException: could not prepare statement [Column "M1_0.USERNAME" not found; SQL statement:

select m1_0.id,m1_0.username from member m1_0 where m1_0.username=? [42122-214]] [select m1_0.id,m1_0.username from member m1_0 where m1_0.username=?]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

at app//hello.hellospring.repository.JpaMemberRepository.findByName(JpaMemberRepository.java:33)

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

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

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

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

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

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

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

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

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

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

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

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

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.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:756)

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

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

at app//hello.hellospring.service.MemberServiceIntegrationTest.회원가입(MemberServiceIntegrationTest.java:28)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)

at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)

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

at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)

at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)

at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)

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

at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)

at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)

at java.base@17.0.4.1/java.util.ArrayList.forEach(ArrayList.java:1511)

at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)

at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)

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

at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)

at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)

at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)

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

at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)

at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)

at java.base@17.0.4.1/java.util.ArrayList.forEach(ArrayList.java:1511)

at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)

at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)

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

at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)

at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)

at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)

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

at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)

at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)

at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)

at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)

at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)

at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)

at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)

at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)

at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)

at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)

at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)

at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)

at app//org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)

at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:110)

at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:90)

at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:85)

at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:62)

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

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

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

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

at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)

at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)

at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)

at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)

at jdk.proxy1/jdk.proxy1.$Proxy2.stop(Unknown Source)

at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193)

at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)

at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)

at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)

at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)

at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)

at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)

at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)

at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "M1_0.USERNAME" not found; SQL statement:

select m1_0.id,m1_0.username from member m1_0 where m1_0.username=? [42122-220]

at org.h2.message.DbException.getJdbcSQLException(DbException.java:514)

at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)

at org.h2.message.DbException.get(DbException.java:223)

at org.h2.message.DbException.get(DbException.java:199)

at org.h2.expression.ExpressionColumn.getColumnException(ExpressionColumn.java:244)

at org.h2.expression.ExpressionColumn.optimizeOther(ExpressionColumn.java:226)

at org.h2.expression.ExpressionColumn.optimize(ExpressionColumn.java:213)

at org.h2.command.query.Select.prepareExpressions(Select.java:1170)

at org.h2.command.query.Query.prepare(Query.java:218)

at org.h2.command.Parser.prepareCommand(Parser.java:583)

at org.h2.engine.SessionLocal.prepareLocal(SessionLocal.java:634)

at org.h2.server.TcpServerThread.process(TcpServerThread.java:288)

at org.h2.server.TcpServerThread.run(TcpServerThread.java:191)

at java.base/java.lang.Thread.run(Thread.java:833)

at app//org.h2.message.DbException.getJdbcSQLException(DbException.java:502)

at app//org.h2.engine.SessionRemote.readException(SessionRemote.java:637)

at app//org.h2.engine.SessionRemote.done(SessionRemote.java:606)

at app//org.h2.command.CommandRemote.prepare(CommandRemote.java:78)

at app//org.h2.command.CommandRemote.<init>(CommandRemote.java:50)

at app//org.h2.engine.SessionRemote.prepareCommand(SessionRemote.java:480)

at app//org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1116)

at app//org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:92)

at app//org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:288)

at app//com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:327)

at app//com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)

at app//org.hibernate.engine.jdbc.internal.StatementPreparerImpl$1.doPrepare(StatementPreparerImpl.java:91)

at app//org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:177)

... 123 more

Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended

MemberServiceIntegrationTest > ȸ������() FAILED

org.hibernate.exception.SQLGrammarException at MemberServiceIntegrationTest.java:28

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException at MemberServiceIntegrationTest.java:28

2023-08-20T14:08:26.076+09:00 INFO 17356 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'

2023-08-20T14:08:26.079+09:00 INFO 17356 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...

2023-08-20T14:08:26.109+09:00 INFO 17356 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.

1 test completed, 1 failed

> Task :test FAILED

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':test'.

> There were failing tests. See the report at: file:///C:/Users/man25/OneDrive/����%20ȭ��/������%20����/hello-spring/build/reports/tests/test/index.html

* Try:

> Run with --stacktrace option to get the stack trace.

> Run with --info or --debug option to get more log output.

> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 22s

4 actionable tasks: 1 executed, 3 up-to-date

 

아래 사진은 application.properties 디렉터리의 코드입니다.

캡처.PNG

 

아래 사진은 SpringConfig 클래스의 코드입니다.

 

 

 

 

 

16.PNG

 

 

해결 방법을 모르겠네요ㅠㅠㅠ

답변 4

3

안녕하세요. 김수환님, 공식 서포터즈 코즈위버입니다.

조경현님 말씀처럼, 데이터베이스에 username 컬럼이 없어 발생하는 오류입니다. ddl-auto=create 은 엔터티 정보를 기준으로 기존 테이블을 삭제하고 다시 생성하게 되고, 오류가 해결된 것이지요.

개발중에는 엔터티 속성이 수시로 바뀌므로 이 값을 create 혹은 create-drop 으로 하시는 것이 편하실거에요 :)

감사합니다.

앗 무슨정신으로 저렇게 답변을 달았는지 ㅎㅎ..

정확한 답변 감사합니다 :) 제 답변도 혼동을 방지하기 위해 수정했어요. :+1:

1

안녕하세요 같은 오류를 겪는 분들이 있을 것 같아 답변을 남깁니다.
저도 강좌 수강 도중 동일한 오류 발생을 겪었습니다. 이 오류가 나는 이유는 다음과 같습니다.

image김영한 강사님께서 앞에서 @Column 애노테이션을 설명하는 과정에서 Member 객체의 name 변수에 상단의 사진과 같이 @Column(name = "username") 애노테이션을 추가하는 것으로 예를 들어 설명 해 주셨습니다. 이 애노테이션은 데이터베이스에 username 이라는 칼럼이 있으면 이 객체를 그 칼럼과 매핑하라는 뜻의 애노테이션입니다. 그러나 강사님께서는 설명 후 이 애노테이션을 지우셨습니다. 저의 경우는 수업을 따로 기록하며 듣다보니 강사님께서 이 코드를 지우는 것을 미처 보지 못해 따라 지우지 못했고, 이후 테스트 코드 실행시 username 이라는 칼럼이 DB에 없다는 오류가 발생하며 테스트가 실패했습니다. 그러다 우연히 Member 객체의 코드를 확인해 본 뒤 알게 되었습니다.
저와 같은 고생을 하시는 분이 없었으면 하여 기록을 남깁니다. 열심히 공부하는 당신, 화이팅!

1

본문에 에러메시지 중 일부를 보면

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "M1_0.USERNAME" not found; SQL statement:

와 같은 부분이 있는데요, 아마 DB에 컬럼이 없던것 같습니다.

 

잘못된 답변으로 혼동드려 죄송합니다 ㅎㅎ,, 아래 코즈위버님께서 작성하신 답변 참고 부탁드립니다 :)

spring.jpa.hiberate.ddl-auto=create 옵션은, 테이블이나 필드가 없으면 새로 생성하라는 의미입니다.

그래서 없던 컬럼이 새로 생성되면서 테스트코드가 정상적으로 실행된거구요.

1

김수환님의 프로필 이미지
김수환
질문자

application.properties 디렉터리의 spring.jpa.hiberate.ddl-auto=none에서 none을 create로 바꾸어 보았는데 갑자기 에러가 사라지고, 실행이 됐습니다. 혹시 잘못된 방법일까요??

다른 분들 해결방법 중에 이러한 방법이 있길래 실행해봤는데,,, 옳은 방법인지를 모르겠네요ㅠㅠ

상단의 에러가 난 이유를 도저히 모르겠어요ㅠㅠㅠ

 

 

 

  • 추가: 위의 방법과 같이 에러를 수정하였더니

    Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended 이러한 붉은 메시지가 콘솔창에 띄워졌습니다.

김수환님의 프로필 이미지
김수환

작성한 질문수

질문하기