• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

h2 데이터베이스 테이블 생성이 안됩니다.

23.09.06 15:58 작성 조회수 695

0

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

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

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

[질문 내용]
2023-09-06T15:55:42.478+09:00 INFO 7976 --- [ restartedMain] jpabooks.jpashop.JpashopApplication : Starting JpashopApplication using Java 17.0.7 with PID 7976 (D:\SelfStudySpring\jpashop\out\production\classes started by sjj in D:\SelfStudySpring\jpashop)

2023-09-06T15:55:42.483+09:00 INFO 7976 --- [ restartedMain] jpabooks.jpashop.JpashopApplication : No active profile set, falling back to 1 default profile: "default"

2023-09-06T15:55:42.569+09:00 INFO 7976 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable

2023-09-06T15:55:42.570+09:00 INFO 7976 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'

2023-09-06T15:55:43.452+09:00 INFO 7976 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.

2023-09-06T15:55:43.482+09:00 INFO 7976 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 20 ms. Found 0 JPA repository interfaces.

2023-09-06T15:55:44.366+09:00 INFO 7976 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8086 (http)

2023-09-06T15:55:44.380+09:00 INFO 7976 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]

2023-09-06T15:55:44.380+09:00 INFO 7976 --- [ restartedMain] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.12]

2023-09-06T15:55:44.496+09:00 INFO 7976 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext

2023-09-06T15:55:44.498+09:00 INFO 7976 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1926 ms

2023-09-06T15:55:44.655+09:00 INFO 7976 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...

2023-09-06T15:55:44.856+09:00 INFO 7976 --- [ restartedMain] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection conn0: url=jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b user=SA

2023-09-06T15:55:44.858+09:00 INFO 7976 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.

2023-09-06T15:55:44.873+09:00 INFO 7976 --- [ restartedMain] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b'

2023-09-06T15:55:45.058+09:00 INFO 7976 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]

2023-09-06T15:55:45.138+09:00 INFO 7976 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 6.2.7.Final

2023-09-06T15:55:45.141+09:00 INFO 7976 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000406: Using bytecode reflection optimizer

2023-09-06T15:55:45.313+09:00 INFO 7976 --- [ restartedMain] o.h.b.i.BytecodeProviderInitiator : HHH000021: Bytecode provider name : bytebuddy

2023-09-06T15:55:45.520+09:00 INFO 7976 --- [ restartedMain] o.s.o.j.p.SpringPersistenceUnitInfo : No LoadTimeWeaver setup: ignoring JPA class transformer

2023-09-06T15:55:45.966+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983345966 | took 9ms | statement | connection 2| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

select * from INFORMATION_SCHEMA.SEQUENCES

select * from INFORMATION_SCHEMA.SEQUENCES;

2023-09-06T15:55:45.983+09:00 INFO 7976 --- [ restartedMain] o.h.b.i.BytecodeProviderInitiator : HHH000021: Bytecode provider name : bytebuddy

2023-09-06T15:55:46.832+09:00 INFO 7976 --- [ restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]

2023-09-06T15:55:46.853+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

drop table if exists category cascade

2023-09-06T15:55:46.854+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346854 | took 0ms | statement | connection 3| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

drop table if exists category cascade

drop table if exists category cascade ;

2023-09-06T15:55:46.855+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

drop table if exists category_item cascade

2023-09-06T15:55:46.855+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346855 | took 0ms | statement | connection 3| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

drop table if exists category_item cascade

drop table if exists category_item cascade ;

2023-09-06T15:55:46.855+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

drop table if exists delivery cascade

2023-09-06T15:55:46.855+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346855 | took 0ms | statement | connection 3| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

drop table if exists delivery cascade

drop table if exists delivery cascade ;

2023-09-06T15:55:46.855+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

drop table if exists item cascade

2023-09-06T15:55:46.855+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346855 | took 0ms | statement | connection 3| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

drop table if exists item cascade

drop table if exists item cascade ;

2023-09-06T15:55:46.855+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

drop table if exists member cascade

2023-09-06T15:55:46.855+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346855 | took 0ms | statement | connection 3| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

drop table if exists member cascade

drop table if exists member cascade ;

2023-09-06T15:55:46.856+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

drop table if exists order_item cascade

2023-09-06T15:55:46.856+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346856 | took 0ms | statement | connection 3| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

drop table if exists order_item cascade

drop table if exists order_item cascade ;

2023-09-06T15:55:46.856+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

drop table if exists orders cascade

2023-09-06T15:55:46.856+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346856 | took 0ms | statement | connection 3| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

drop table if exists orders cascade

drop table if exists orders cascade ;

2023-09-06T15:55:46.856+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

drop sequence if exists category_seq

2023-09-06T15:55:46.857+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346857 | took 0ms | statement | connection 3| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

drop sequence if exists category_seq

drop sequence if exists category_seq;

2023-09-06T15:55:46.857+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

drop sequence if exists delivery_seq

2023-09-06T15:55:46.857+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346857 | took 0ms | statement | connection 3| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

drop sequence if exists delivery_seq

drop sequence if exists delivery_seq;

2023-09-06T15:55:46.857+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

drop sequence if exists item_seq

2023-09-06T15:55:46.857+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346857 | took 0ms | statement | connection 3| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

drop sequence if exists item_seq

drop sequence if exists item_seq;

2023-09-06T15:55:46.858+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

drop sequence if exists member_seq

2023-09-06T15:55:46.858+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346858 | took 0ms | statement | connection 3| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

drop sequence if exists member_seq

drop sequence if exists member_seq;

2023-09-06T15:55:46.858+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

drop sequence if exists order_item_seq

2023-09-06T15:55:46.858+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346858 | took 0ms | statement | connection 3| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

drop sequence if exists order_item_seq

drop sequence if exists order_item_seq;

2023-09-06T15:55:46.858+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

drop sequence if exists orders_seq

2023-09-06T15:55:46.858+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346858 | took 0ms | statement | connection 3| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

drop sequence if exists orders_seq

drop sequence if exists orders_seq;

2023-09-06T15:55:46.863+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

create sequence category_seq start with 1 increment by 50

2023-09-06T15:55:46.865+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346865 | took 1ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

create sequence category_seq start with 1 increment by 50

create sequence category_seq start with 1 increment by 50;

2023-09-06T15:55:46.865+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

create sequence delivery_seq start with 1 increment by 50

2023-09-06T15:55:46.865+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346865 | took 0ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

create sequence delivery_seq start with 1 increment by 50

create sequence delivery_seq start with 1 increment by 50;

2023-09-06T15:55:46.865+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

create sequence item_seq start with 1 increment by 50

2023-09-06T15:55:46.866+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346866 | took 0ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

create sequence item_seq start with 1 increment by 50

create sequence item_seq start with 1 increment by 50;

2023-09-06T15:55:46.866+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

create sequence member_seq start with 1 increment by 50

2023-09-06T15:55:46.866+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346866 | took 0ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

create sequence member_seq start with 1 increment by 50

create sequence member_seq start with 1 increment by 50;

2023-09-06T15:55:46.866+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

create sequence order_item_seq start with 1 increment by 50

2023-09-06T15:55:46.867+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346867 | took 0ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

create sequence order_item_seq start with 1 increment by 50

create sequence order_item_seq start with 1 increment by 50;

2023-09-06T15:55:46.867+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

create sequence orders_seq start with 1 increment by 50

2023-09-06T15:55:46.867+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346867 | took 0ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

create sequence orders_seq start with 1 increment by 50

create sequence orders_seq start with 1 increment by 50;

2023-09-06T15:55:46.869+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

create table category (

category_id bigint not null,

parent_id bigint,

name varchar(255),

primary key (category_id)

)

2023-09-06T15:55:46.873+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346873 | took 3ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

create table category (

category_id bigint not null,

parent_id bigint,

name varchar(255),

primary key (category_id)

)

create table category (

category_id bigint not null,

parent_id bigint,

name varchar(255),

primary key (category_id)

);

2023-09-06T15:55:46.874+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

create table category_item (

category_id bigint not null,

item_id bigint not null

)

2023-09-06T15:55:46.874+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346874 | took 0ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

create table category_item (

category_id bigint not null,

item_id bigint not null

)

create table category_item (

category_id bigint not null,

item_id bigint not null

);

2023-09-06T15:55:46.874+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

create table delivery (

delivery_id bigint not null,

city varchar(255),

status varchar(255) check (status in ('READY','COMP')),

street varchar(255),

zipcode varchar(255),

primary key (delivery_id)

)

2023-09-06T15:55:46.876+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346876 | took 1ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

create table delivery (

delivery_id bigint not null,

city varchar(255),

status varchar(255) check (status in ('READY','COMP')),

street varchar(255),

zipcode varchar(255),

primary key (delivery_id)

)

create table delivery (

delivery_id bigint not null,

city varchar(255),

status varchar(255) check (status in ('READY','COMP')),

street varchar(255),

zipcode varchar(255),

primary key (delivery_id)

);

2023-09-06T15:55:46.877+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

create table item (

price integer not null,

stock_quantity integer not null,

item_id bigint not null,

dtype varchar(31) not null,

actor varchar(255),

artist varchar(255),

author varchar(255),

director varchar(255),

etc varchar(255),

isbn varchar(255),

name varchar(255),

primary key (item_id)

)

2023-09-06T15:55:46.878+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346878 | took 0ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

create table item (

price integer not null,

stock_quantity integer not null,

item_id bigint not null,

dtype varchar(31) not null,

actor varchar(255),

artist varchar(255),

author varchar(255),

director varchar(255),

etc varchar(255),

isbn varchar(255),

name varchar(255),

primary key (item_id)

)

create table item (

price integer not null,

stock_quantity integer not null,

item_id bigint not null,

dtype varchar(31) not null,

actor varchar(255),

artist varchar(255),

author varchar(255),

director varchar(255),

etc varchar(255),

isbn varchar(255),

name varchar(255),

primary key (item_id)

);

2023-09-06T15:55:46.878+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

create table member (

member_id bigint not null,

city varchar(255),

name varchar(255),

street varchar(255),

zipcode varchar(255),

primary key (member_id)

)

2023-09-06T15:55:46.879+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346879 | took 0ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

create table member (

member_id bigint not null,

city varchar(255),

name varchar(255),

street varchar(255),

zipcode varchar(255),

primary key (member_id)

)

create table member (

member_id bigint not null,

city varchar(255),

name varchar(255),

street varchar(255),

zipcode varchar(255),

primary key (member_id)

);

2023-09-06T15:55:46.879+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

create table order_item (

count integer not null,

order_price integer not null,

item_id bigint,

order_id bigint,

order_item_id bigint not null,

primary key (order_item_id)

)

2023-09-06T15:55:46.880+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346880 | took 0ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

create table order_item (

count integer not null,

order_price integer not null,

item_id bigint,

order_id bigint,

order_item_id bigint not null,

primary key (order_item_id)

)

create table order_item (

count integer not null,

order_price integer not null,

item_id bigint,

order_id bigint,

order_item_id bigint not null,

primary key (order_item_id)

);

2023-09-06T15:55:46.882+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

create table orders (

status tinyint check (status between 0 and 1),

delivery_id bigint unique,

member_id bigint,

order_date timestamp(6),

order_id bigint not null,

primary key (order_id)

)

2023-09-06T15:55:46.885+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346885 | took 2ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

create table orders (

status tinyint check (status between 0 and 1),

delivery_id bigint unique,

member_id bigint,

order_date timestamp(6),

order_id bigint not null,

primary key (order_id)

)

create table orders (

status tinyint check (status between 0 and 1),

delivery_id bigint unique,

member_id bigint,

order_date timestamp(6),

order_id bigint not null,

primary key (order_id)

);

2023-09-06T15:55:46.886+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

alter table if exists category

add constraint FK2y94svpmqttx80mshyny85wqr

foreign key (parent_id)

references category

2023-09-06T15:55:46.892+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346892 | took 6ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

alter table if exists category

add constraint FK2y94svpmqttx80mshyny85wqr

foreign key (parent_id)

references category

alter table if exists category

add constraint FK2y94svpmqttx80mshyny85wqr

foreign key (parent_id)

references category;

2023-09-06T15:55:46.892+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

alter table if exists category_item

add constraint FKu8b4lwqutcdq3363gf6mlujq

foreign key (item_id)

references item

2023-09-06T15:55:46.894+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346894 | took 1ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

alter table if exists category_item

add constraint FKu8b4lwqutcdq3363gf6mlujq

foreign key (item_id)

references item

alter table if exists category_item

add constraint FKu8b4lwqutcdq3363gf6mlujq

foreign key (item_id)

references item;

2023-09-06T15:55:46.894+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

alter table if exists category_item

add constraint FKcq2n0opf5shyh84ex1fhukcbh

foreign key (category_id)

references category

2023-09-06T15:55:46.895+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346895 | took 1ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

alter table if exists category_item

add constraint FKcq2n0opf5shyh84ex1fhukcbh

foreign key (category_id)

references category

alter table if exists category_item

add constraint FKcq2n0opf5shyh84ex1fhukcbh

foreign key (category_id)

references category;

2023-09-06T15:55:46.895+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

alter table if exists order_item

add constraint FKija6hjjiit8dprnmvtvgdp6ru

foreign key (item_id)

references item

2023-09-06T15:55:46.897+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346897 | took 1ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

alter table if exists order_item

add constraint FKija6hjjiit8dprnmvtvgdp6ru

foreign key (item_id)

references item

alter table if exists order_item

add constraint FKija6hjjiit8dprnmvtvgdp6ru

foreign key (item_id)

references item;

2023-09-06T15:55:46.897+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

alter table if exists order_item

add constraint FKt4dc2r9nbvbujrljv3e23iibt

foreign key (order_id)

references orders

2023-09-06T15:55:46.898+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346898 | took 1ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

alter table if exists order_item

add constraint FKt4dc2r9nbvbujrljv3e23iibt

foreign key (order_id)

references orders

alter table if exists order_item

add constraint FKt4dc2r9nbvbujrljv3e23iibt

foreign key (order_id)

references orders;

2023-09-06T15:55:46.898+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

alter table if exists orders

add constraint FKtkrur7wg4d8ax0pwgo0vmy20c

foreign key (delivery_id)

references delivery

2023-09-06T15:55:46.899+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346899 | took 1ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

alter table if exists orders

add constraint FKtkrur7wg4d8ax0pwgo0vmy20c

foreign key (delivery_id)

references delivery

alter table if exists orders

add constraint FKtkrur7wg4d8ax0pwgo0vmy20c

foreign key (delivery_id)

references delivery;

2023-09-06T15:55:46.899+09:00 DEBUG 7976 --- [ restartedMain] org.hibernate.SQL :

alter table if exists orders

add constraint FKpktxwhj3x9m4gth5ff6bkqgeb

foreign key (member_id)

references member

2023-09-06T15:55:46.901+09:00 INFO 7976 --- [ restartedMain] p6spy : #1693983346901 | took 1ms | statement | connection 4| url jdbc:h2:mem:1f4065c7-8198-4f9e-a2f8-a5551835504b

alter table if exists orders

add constraint FKpktxwhj3x9m4gth5ff6bkqgeb

foreign key (member_id)

references member

alter table if exists orders

add constraint FKpktxwhj3x9m4gth5ff6bkqgeb

foreign key (member_id)

references member;

2023-09-06T15:55:46.903+09:00 INFO 7976 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'

2023-09-06T15:55:46.956+09:00 WARN 7976 --- [ 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

2023-09-06T15:55:47.167+09:00 INFO 7976 --- [ restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html]

2023-09-06T15:55:47.418+09:00 INFO 7976 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729

2023-09-06T15:55:47.469+09:00 INFO 7976 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8086 (http) with context path ''

2023-09-06T15:55:47.487+09:00 INFO 7976 --- [ restartedMain] jpabooks.jpashop.JpashopApplication : Started JpashopApplication in 5.642 seconds (process running for 6.434)

답변 2

·

답변을 작성해보세요.

0

y2gcoder님의 프로필

y2gcoder

2023.09.08

보내주신 코드 살펴봤습니다!

원인은 application.yml 에 있습니다.

기존 application.yml에서 db 연결하는 부분이

image이렇게 되어있습니다(노란색으로 지금 warning이 떠있는 것이 보입니다). 들여쓰기가 제대로 되어있지 않아서 결과적으로 스프링 부트는 DB 연결시 h2에 대한 기본설정인 인메모리 DB를 사용하고 있기 때문에 실제 DB에 반영이 되지 않은 것 같습니다.

imagedatasource 밑의 들여쓰기를 올바르게 해주시고 다시 애플리케이션을 시작해보시면 될 것 같습니다 :)

 

image

0

y2gcoder님의 프로필

y2gcoder

2023.09.07

안녕하세요. 신재진님, 공식 서포터즈 y2gcoder입니다.

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

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

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

https://bit.ly/3fX6ygx


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


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

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

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

감사합니다.

신재진님의 프로필

신재진

질문자

2023.09.07

https://drive.google.com/file/d/10F_Q0m1rSCIHJaLcFbQ-7HUxvWOOdVhp/view?usp=sharing

h2 데이터베이스도 켜놓고 해당 mv파일도 존재하고 강의 내용을 따라 치면서 JpashopApplication을 실행해보니까 콘솔 창에는 테이블이 생성되어 있다고 뜨지만 정작 h2 데이터베이스에는 어떤 테이블도 생성되지 않는 것을 확인했습니다.