inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

실전! 스프링 부트와 JPA 활용2 - API 개발과 성능 최적화

회원 조회 API

h2 테이블 생성이 안됩니다

해결된 질문

946

이태휘

작성한 질문수 2

0


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

[질문 내용]
여기에 질문 내용을 남겨주세요.

 

안녕하세요 강의 잘 수강하고 있습니다.

h2 디비를 사용하고 있는데,전에는 잘 되다가 갑자기 테이블이 생성이 되지 않습니다.

18:44:52.704 [Thread-0] DEBUG org.springframework.boot.devtools.restart.classloader.RestartClassLoader - Created RestartClassLoader org.springframework.boot.devtools.restart.classloader.RestartClassLoader@29beb06e

. ____ _

/\\ / ___'_ __ (_)_ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

\\/ ___)| |_)| | | | | || (_| | ) ) ) )

' |____| .__|_| |_|_| |_\__, | / / / /

=========|_|==============|___/=/_/_/_/

:: Spring Boot :: (v2.7.4)

2022-11-01 18:44:53.018 INFO 37580 --- [ restartedMain] jpabook.jpashop.JpashopApplication : Starting JpashopApplication using Java 17.0.4.1 on itaehwis-MacBook-Pro.local with PID 37580 (/Users/taehwi/Desktop/멋사/Recruit_Page/jpashop/build/classes/java/main started by taehwi in /Users/taehwi/Desktop/멋사/Recruit_Page/jpashop)

2022-11-01 18:44:53.024 INFO 37580 --- [ restartedMain] jpabook.jpashop.JpashopApplication : No active profile set, falling back to 1 default profile: "default"

2022-11-01 18:44:53.078 INFO 37580 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable

2022-11-01 18:44:53.078 INFO 37580 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'

2022-11-01 18:44:53.979 INFO 37580 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.

2022-11-01 18:44:53.993 INFO 37580 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 6 ms. Found 0 JPA repository interfaces.

2022-11-01 18:44:54.368 INFO 37580 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)

2022-11-01 18:44:54.374 INFO 37580 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]

2022-11-01 18:44:54.374 INFO 37580 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.65]

2022-11-01 18:44:54.421 INFO 37580 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext

2022-11-01 18:44:54.421 INFO 37580 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1342 ms

2022-11-01 18:44:54.478 INFO 37580 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...

2022-11-01 18:44:54.557 INFO 37580 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.

2022-11-01 18:44:54.564 INFO 37580 --- [ restartedMain] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:h2:tcp://localhost/~/jpashop'

2022-11-01 18:44:54.659 INFO 37580 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]

2022-11-01 18:44:54.697 INFO 37580 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.11.Final

2022-11-01 18:44:54.810 INFO 37580 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}

2022-11-01 18:44:54.881 INFO 37580 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect

2022-11-01 18:44:55.349 INFO 37580 --- [ restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]

2022-11-01 18:44:55.355 INFO 37580 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'

2022-11-01 18:44:55.425 WARN 37580 --- [ restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning

2022-11-01 18:44:55.520 INFO 37580 --- [ restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html]

2022-11-01 18:44:55.652 INFO 37580 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729

2022-11-01 18:44:55.677 INFO 37580 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''

2022-11-01 18:44:55.686 INFO 37580 --- [ restartedMain] jpabook.jpashop.JpashopApplication : Started JpashopApplication in 2.965 seconds (JVM running for 3.588)

 

이렇게 오류 없이 스프링이 돌아가는데, h2 화면에 들어가보면

Screen Shot 2022-11-01 at 6.47.43 PM.png이런식으로 테이블이 하나도 생성이 안됩니다.

 

제 application.yml 코드입니다

Screen Shot 2022-11-01 at 6.48.36 PM.png

해결 부탁드립니다

spring-boot java spring JPA

답변 2

1

나무늘보

안녕하세요, 이태휘 님! 공식 서포터즈 codesweaver 입니다.

ddl-auto 옵션이 none으로 되어 있습니다. none 상태에서는 하이버네이트에서 테이블을 건드리지 않습니다.

이 옵션을 create 등으로 변경해주세요.

감사합니다.

0

이태휘

앗 근데 강사님이 강의에서 none으로 바꾸라고 했던 점은 무엇인가요?

0

나무늘보

안녕하세요 이태휘님.

강의 중 ddl-auto를 none으로 설정하는 부분은,

테이블을 더 이상 수정할 필요 없이, 이미 넣어둔 데이터로 테스트를 하고자 할 때 입니다.

이 때는 테이블을 매번 지우고 다시 만들 필요가 없기에 none으로 설정해도 무방합니다.

 

감사합니다.

강의 관련 외 질문입니다.

0

62

2

SpringBoot4 + Hibernate7 모듈 등록 방법 공유

0

85

1

BeanCreationException

0

86

3

Update 후 UpdateMemberResponse 매핑할 때

0

46

1

트랜잭션을 사용 안 할 때 커넥션은 언제 가져오나요?

0

96

2

페이징 + 검색조건 관련해서 질문드립니다.

0

70

1

Query Dsl Q파일 질문입니다.

0

81

1

루트 쿼리라는것은

0

58

1

메서드를 분리하는 기준

0

61

1

findAllWithMemberDelivery 메서드 질문드립니다.

0

108

3

연관관계 매핑을 안 쓸 경우, 사용해야 하는 전략

0

83

2

fetch join과 영속화와 OSIV의 관계

0

83

2

Distinct 사용 전 결과에 대한 의문

0

112

2

레포지토리 계층에서의 트랜잭션에 대한 의문

0

55

1

영속성 컨텍스트 생명주기의 신기한 부분이 있습니다.

0

77

2

dto 필드 속 엔티티 여부

0

58

1

뷰템플릿 사용 시

0

76

2

Result 클래스 관련 질문

0

56

1

@PostConstruct 프록시 관련 질문드립니다

0

85

1

DTO 대신 Form 사용은 안되나요?

0

133

1

OSIV ON 상태일 때

0

94

1

fetch join VS fetch join 페이징 궁금증

0

178

2

양방향 연관관계 알아보는 법?

0

102

1

16강 17강 간단 정리 이게 맞을까요 ?

0

161

2