해결된 질문
작성
·
380
0
안녕하세요, JPA 강의 잘 듣고 있습니다.
실전예제2 실습을 진행하면서 아래와 같은 에러 메시지가 발생하였습니다.
H2 데이터베이스에는, ORDER 테이블을 제외한 다른 테이블(+인덱스 포함) 및 시퀀스는 생성되었으며, ORDER 테이블만 생성되지 않았습니다.
코드 진행 시 어떤 실수를 했기에 발생한 문제인지 알 수 있을까요?
코드 압축파일도 첨부합니다.
(링크)
2월 08, 2023 4:53:12 오후 org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@40712ee9] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.
2월 08, 2023 4:53:12 오후 org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL "
drop table ORDER if exists" via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "
drop table ORDER if exists" via JDBC Statement
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)
at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:375)
at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:359)
at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:241)
at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:154)
at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:126)
at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:112)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:144)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:310)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:939)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at jpabook.jpashop.JpaMain.main(JpaMain.java:12)
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "\000d\000a drop table [*]ORDER if exists"; expected "identifier"; SQL statement:
drop table ORDER if exists [42001-214]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:502)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:477)
at org.h2.message.DbException.getSyntaxError(DbException.java:261)
at org.h2.command.Parser.readIdentifier(Parser.java:5656)
at org.h2.command.Parser.readIdentifierWithSchema(Parser.java:5616)
at org.h2.command.Parser.readIdentifierWithSchema(Parser.java:5645)
at org.h2.command.Parser.parseDrop(Parser.java:2188)
at org.h2.command.Parser.parsePrepared(Parser.java:776)
at org.h2.command.Parser.parse(Parser.java:689)
at org.h2.command.Parser.parse(Parser.java:661)
at org.h2.command.Parser.prepareCommand(Parser.java:569)
at org.h2.engine.SessionLocal.prepareLocal(SessionLocal.java:631)
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 org.h2.message.DbException.getJdbcSQLException(DbException.java:502)
at org.h2.engine.SessionRemote.readException(SessionRemote.java:637)
at org.h2.engine.SessionRemote.done(SessionRemote.java:606)
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:480)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1116)
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:237)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:223)
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
... 15 more
2월 08, 2023 4:53:12 오후 org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@34f392be] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.
2월 08, 2023 4:53:12 오후 org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL "
create table ORDER (
ORDER_ID bigint not null,
orderDate timestamp,
status varchar(255),
MEMBER_ID bigint,
primary key (ORDER_ID)
)" via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "
create table ORDER (
ORDER_ID bigint not null,
orderDate timestamp,
status varchar(255),
MEMBER_ID bigint,
primary key (ORDER_ID)
)" via JDBC Statement
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlString(SchemaCreatorImpl.java:440)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlStrings(SchemaCreatorImpl.java:424)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.createFromMetadata(SchemaCreatorImpl.java:315)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.performCreation(SchemaCreatorImpl.java:166)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:135)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:121)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:155)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:310)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:939)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at jpabook.jpashop.JpaMain.main(JpaMain.java:12)
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "\000d\000a create table [*]ORDER (\000d\000a ORDER_ID bigint not null,\000d\000a orderDate timestamp,\000d\000a status varchar(255),\000d\000a MEMBER_ID bigint,\000d\000a primary key (ORDER_ID)\000d\000a )"; expected "identifier"; SQL statement:
create table ORDER (
ORDER_ID bigint not null,
orderDate timestamp,
status varchar(255),
MEMBER_ID bigint,
primary key (ORDER_ID)
) [42001-214]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:502)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:477)
at org.h2.message.DbException.getSyntaxError(DbException.java:261)
at org.h2.command.Parser.readIdentifier(Parser.java:5656)
at org.h2.command.Parser.readIdentifierWithSchema(Parser.java:5616)
at org.h2.command.Parser.readIdentifierWithSchema(Parser.java:5645)
at org.h2.command.Parser.parseCreateTable(Parser.java:9253)
at org.h2.command.Parser.parseCreate(Parser.java:6784)
at org.h2.command.Parser.parsePrepared(Parser.java:763)
at org.h2.command.Parser.parse(Parser.java:689)
at org.h2.command.Parser.parse(Parser.java:661)
at org.h2.command.Parser.prepareCommand(Parser.java:569)
at org.h2.engine.SessionLocal.prepareLocal(SessionLocal.java:631)
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 org.h2.message.DbException.getJdbcSQLException(DbException.java:502)
at org.h2.engine.SessionRemote.readException(SessionRemote.java:637)
at org.h2.engine.SessionRemote.done(SessionRemote.java:606)
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:480)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1116)
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:237)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:223)
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
... 15 more
2월 08, 2023 4:53:12 오후 org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL "
alter table ORDER
add constraint FKg2e0q3p7qbn6vhhwweifmdmd5
foreign key (MEMBER_ID)
references MEMBER" via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "
alter table ORDER
add constraint FKg2e0q3p7qbn6vhhwweifmdmd5
foreign key (MEMBER_ID)
references MEMBER" via JDBC Statement
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlString(SchemaCreatorImpl.java:440)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlStrings(SchemaCreatorImpl.java:424)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.createFromMetadata(SchemaCreatorImpl.java:375)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.performCreation(SchemaCreatorImpl.java:166)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:135)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:121)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:155)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:310)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:939)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at jpabook.jpashop.JpaMain.main(JpaMain.java:12)
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "\000d\000a alter table [*]ORDER \000d\000a add constraint FKg2e0q3p7qbn6vhhwweifmdmd5 \000d\000a foreign key (MEMBER_ID) \000d\000a references MEMBER"; expected "identifier"; SQL statement:
alter table ORDER
add constraint FKg2e0q3p7qbn6vhhwweifmdmd5
foreign key (MEMBER_ID)
references MEMBER [42001-214]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:502)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:477)
at org.h2.message.DbException.getSyntaxError(DbException.java:261)
at org.h2.command.Parser.readIdentifier(Parser.java:5656)
at org.h2.command.Parser.readIdentifierWithSchema(Parser.java:5616)
at org.h2.command.Parser.readIdentifierWithSchema(Parser.java:5645)
at org.h2.command.Parser.parseAlterTable(Parser.java:8476)
at org.h2.command.Parser.parseAlter(Parser.java:7548)
at org.h2.command.Parser.parsePrepared(Parser.java:747)
at org.h2.command.Parser.parse(Parser.java:689)
at org.h2.command.Parser.parse(Parser.java:661)
at org.h2.command.Parser.prepareCommand(Parser.java:569)
at org.h2.engine.SessionLocal.prepareLocal(SessionLocal.java:631)
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 org.h2.message.DbException.getJdbcSQLException(DbException.java:502)
at org.h2.engine.SessionRemote.readException(SessionRemote.java:637)
at org.h2.engine.SessionRemote.done(SessionRemote.java:606)
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:480)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1116)
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:237)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:223)
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
... 15 more
2월 08, 2023 4:53:12 오후 org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL "
alter table ORDER_ITEM
add constraint FK1pnpc71663ei4208mahu6w8os
foreign key (ORDER_ID)
references ORDER" via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "
alter table ORDER_ITEM
add constraint FK1pnpc71663ei4208mahu6w8os
foreign key (ORDER_ID)
references ORDER" via JDBC Statement
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlString(SchemaCreatorImpl.java:440)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlStrings(SchemaCreatorImpl.java:424)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.createFromMetadata(SchemaCreatorImpl.java:375)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.performCreation(SchemaCreatorImpl.java:166)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:135)
at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:121)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:155)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:310)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:939)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at jpabook.jpashop.JpaMain.main(JpaMain.java:12)
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "\000d\000a alter table ORDER_ITEM \000d\000a add constraint FK1pnpc71663ei4208mahu6w8os \000d\000a foreign key (ORDER_ID) \000d\000a references [*]ORDER"; expected "identifier"; SQL statement:
alter table ORDER_ITEM
add constraint FK1pnpc71663ei4208mahu6w8os
foreign key (ORDER_ID)
references ORDER [42001-214]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:502)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:477)
at org.h2.message.DbException.getSyntaxError(DbException.java:261)
at org.h2.command.Parser.readIdentifier(Parser.java:5656)
at org.h2.command.Parser.readIdentifierWithSchema(Parser.java:5616)
at org.h2.command.Parser.parseReferences(Parser.java:9180)
at org.h2.command.Parser.parseTableConstraintIf(Parser.java:9114)
at org.h2.command.Parser.parseAlterTable(Parser.java:8479)
at org.h2.command.Parser.parseAlter(Parser.java:7548)
at org.h2.command.Parser.parsePrepared(Parser.java:747)
at org.h2.command.Parser.parse(Parser.java:689)
at org.h2.command.Parser.parse(Parser.java:661)
at org.h2.command.Parser.prepareCommand(Parser.java:569)
at org.h2.engine.SessionLocal.prepareLocal(SessionLocal.java:631)
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 org.h2.message.DbException.getJdbcSQLException(DbException.java:502)
at org.h2.engine.SessionRemote.readException(SessionRemote.java:637)
at org.h2.engine.SessionRemote.done(SessionRemote.java:606)
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:480)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1116)
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:237)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:223)
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
... 15 more
2월 08, 2023 4:53:12 오후 org.hibernate.tool.schema.internal.SchemaCreatorImpl applyImportSources
INFO: HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@12968227'
2월 08, 2023 4:53:12 오후 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl stop
INFO: HHH10001008: Cleaning up connection pool [jdbc:h2:tcp://localhost/~/test]