해결된 질문
작성
·
739
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 화면에 들어가보면
이런식으로 테이블이 하나도 생성이 안됩니다.
제 application.yml 코드입니다
해결 부탁드립니다
답변 2
1
안녕하세요, 이태휘 님! 공식 서포터즈 codesweaver 입니다.
ddl-auto 옵션이 none으로 되어 있습니다. none 상태에서는 하이버네이트에서 테이블을 건드리지 않습니다.
이 옵션을 create 등으로 변경해주세요.
감사합니다.
0
안녕하세요 이태휘님.
강의 중 ddl-auto를 none으로 설정하는 부분은,
테이블을 더 이상 수정할 필요 없이, 이미 넣어둔 데이터로 테스트를 하고자 할 때 입니다.
이 때는 테이블을 매번 지우고 다시 만들 필요가 없기에 none으로 설정해도 무방합니다.
감사합니다.