스프링 JPA 오류 - expected "identifier";

디퐁·2022년 6월 21일
1

오류 내용

2022-06-09 09:30:46.524  WARN 30395 --- [           main] o.h.t.s.i.ExceptionHandlerLoggedImpl     : GenerationTarget encountered exception accepting command : Error executing DDL "
    create table order (
       order_id bigint not null auto_increment,
        accepted_timestamp datetime,
        completed_timestamp datetime,
        cooked_timestamp datetime,
        created_timestamp datetime not null,
        estimated_minutes bigint not null,
        is_delivery bit not null,
        message varchar(100) not null,
        pickuped_timestamp datetime,
        status bigint not null,
        updated_timestamp datetime not null,
        store_id bigint not null,
        user_id bigint not null,
        primary key (order_id)
    ) engine=InnoDB" via JDBC Statement

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "

expected "identifier"; SQL statement:

원인

테이블 이름을 Order로 했는데, Order가 SQL의 예약어였다.
참고: SQL 예약어 목록

해결 방법

테이블 이름을 Orders로 바꿔줬더니 오류가 해결되었다.

profile
Backend 취준생

1개의 댓글

comment-user-thumbnail
2022년 9월 16일

도움이 됐어요 ~ ^^

답글 달기