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

wjscksals0702님의 프로필 이미지
wjscksals0702

작성한 질문수

실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발

JPA와 DB 설정, 동작확인

Transactianl DB 연동 부분 테스트 오류 질문입니다.

작성

·

526

0

[질문 템플릿]
1. 강의 내용과 관련된 질문인가요? (예)
2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예)
3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예)

[질문 내용]
JPA와 DB 설정, 동작확인 강의 13:41 부분 테스트 실행시 밑에와 같은 오류가 발생합니다. yml 띄어쓰기도 확인했는데 이상이 없습니다. 왜 안될까요....

 

org.springframework.dao.InvalidDataAccessResourceUsageException: could not prepare statement [Sequence "MEMBER_SEQ" not found; SQL statement:

select next value for member_seq [90036-224]] [select next value for member_seq]; SQL [select next value for member_seq]

at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:277)

at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:241)

at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:550)

at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)

at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:335)

at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:152)

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

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

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

at jpabook.jpashop.MemberRepository$$SpringCGLIB$$0.save(<generated>)

at jpabook.jpashop.MemberRepositoryTest.testMember(MemberRepositoryTest.java:28)

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

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

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

Caused by: org.hibernate.exception.SQLGrammarException: could not prepare statement [Sequence "MEMBER_SEQ" not found; SQL statement:

select next value for member_seq [90036-224]] [select next value for member_seq]

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

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

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

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

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

at org.hibernate.id.enhanced.SequenceStructure$1.getNextValue(SequenceStructure.java:100)

at org.hibernate.id.enhanced.PooledOptimizer.generate(PooledOptimizer.java:76)

at org.hibernate.id.enhanced.SequenceStyleGenerator.generate(SequenceStyleGenerator.java:555)

at org.hibernate.id.IdentifierGenerator.generate(IdentifierGenerator.java:147)

at org.hibernate.event.internal.AbstractSaveEventListener.generateId(AbstractSaveEventListener.java:153)

at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:124)

at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:175)

at org.hibernate.event.internal.DefaultPersistEventListener.persist(DefaultPersistEventListener.java:93)

at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:77)

at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:54)

at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127)

at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:774)

at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:758)

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.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:319)

at jdk.proxy2/jdk.proxy2.$Proxy102.persist(Unknown Source)

at jpabook.jpashop.MemberRepository.save(MemberRepository.java:14)

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:351)

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:765)

at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)

... 8 more

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Sequence "MEMBER_SEQ" not found; SQL statement:

select next value for member_seq [90036-200]

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

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

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

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

at org.h2.command.Parser.readSequence(Parser.java:7678)

at org.h2.command.Parser.readTermWithIdentifier(Parser.java:4593)

at org.h2.command.Parser.readTerm(Parser.java:4311)

at org.h2.command.Parser.readFactor(Parser.java:3343)

at org.h2.command.Parser.readSum(Parser.java:3330)

at org.h2.command.Parser.readConcat(Parser.java:3305)

at org.h2.command.Parser.readCondition(Parser.java:3108)

at org.h2.command.Parser.readExpression(Parser.java:3059)

at org.h2.command.Parser.parseSelectExpressions(Parser.java:2931)

at org.h2.command.Parser.parseSelect(Parser.java:2952)

at org.h2.command.Parser.parseQuerySub(Parser.java:2817)

at org.h2.command.Parser.parseSelectUnion(Parser.java:2649)

at org.h2.command.Parser.parseQuery(Parser.java:2620)

at org.h2.command.Parser.parsePrepared(Parser.java:868)

at org.h2.command.Parser.parse(Parser.java:843)

at org.h2.command.Parser.parse(Parser.java:815)

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

at org.h2.engine.Session.prepareLocal(Session.java:657)

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

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

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

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

at org.h2.engine.SessionRemote.readException(SessionRemote.java:650)

at org.h2.engine.SessionRemote.done(SessionRemote.java:619)

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

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

at org.h2.engine.SessionRemote.prepareCommand(SessionRemote.java:487)

at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1166)

at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:93)

at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:316)

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

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

at com.p6spy.engine.wrapper.ConnectionWrapper.prepareStatement(ConnectionWrapper.java:118)

at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$1.doPrepare(StatementPreparerImpl.java:94)

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

... 38 more

답변 2

0

김영한님의 프로필 이미지
김영한
지식공유자

안녕하세요. wjscksals0702님

올려주신 코드를 살펴보았는데요.

application.yml에 3곳에 hibername이라고 되어 있습니다.

hibername -> hibernate로 고쳐주셔야 합니다.

감사합니다.

0

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

도움을 드리고 싶지만 질문 내용만으로는 답변을 드리기 어렵습니다.

실제 동작하는 전체 프로젝트를 압축해서 구글 드라이브로 공유해서 링크를 남겨주세요.

구글 드라이브 업로드 방법은 다음을 참고해주세요.

https://bit.ly/3fX6ygx


주의: 업로드시 링크에 있는 권한 문제 꼭 확인해주세요


추가로 다음 내용도 코멘트 부탁드립니다.

1. 문제 영역을 실행할 수 있는 방법

2. 문제가 어떻게 나타나는지에 대한 상세한 설명


링크: 공식 서포터즈

링크: 자주하는 질문

감사합니다.

image

링크 접속이 불가합니다. 자주하는 질문을 참고하여 링크있는 사용자에게 권한 부여 설정을 적용해주세요 😀

wjscksals0702님의 프로필 이미지
wjscksals0702
질문자

wjscksals0702님의 프로필 이미지
wjscksals0702

작성한 질문수

질문하기