ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

๋ฐ˜์‘ํ˜•

error

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "create table [*]order (id bigint generated by default as identity, completed boolean not null, title varchar(255) not null, todo_order bigint not null, primary key (id))"; expected "identifier"; SQL statement: create table order (id bigint generated by default as identity, completed boolean not null, title varchar(255) not null, todo_order bigint not null, primary key (id)) [42001-214]

 

h2 DB ๋ฅผ ์ด์šฉํ•ด์„œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋งŒ๋“ค๋˜์ค‘ ํ•ด๋‹น ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜์˜€๋‹ค.

 

ํ…Œ์ด๋ธ”๋ช…์„ ์ง€์ •ํ•˜์ง€์•Š์œผ๋ฉด ์ •์ƒ์ ์œผ๋กœ ๋™์ž‘ํ–ˆ์ง€๋งŒ ํ…Œ์ด๋ธ”๋ช…์„ ์ง€์ •ํ•˜๊ฒŒ ๋˜๋ฉด ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜์˜€๋‹ค.

 

Solve

@Entity(name = "order")
@Getter
@Setter
public class Todo {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(nullable = false)
    private String title;

    @Column(nullable = false)
    private Long todoOrder;

    @Column(nullable = false)
    private Boolean completed;
}

Entity์˜ ์ด๋ฆ„์„ order๋กœ ์ค€๊ฒƒ์ด ๋ฌธ์ œ์˜€๋‹ค.  "order"๋ผ๋Š” ๋‹จ์–ด๋Š” H2 ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์—์„œ ์˜ˆ์•ฝ์–ด๋กœ ์‚ฌ์šฉ๋˜๊ธฐ ๋•Œ๋ฌธ์— ํ…Œ์ด๋ธ” ์ด๋ฆ„์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๋‹ค. ๋”ฐ๋ผ์„œ "order" ํ…Œ์ด๋ธ”์„ ์ƒ์„ฑํ•˜๋Š” ์ฟผ๋ฆฌ๋ฅผ ์‹คํ–‰ํ•  ๋•Œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•œ๊ฒƒ์ด๋‹ค. ํ•ด๊ฒฐ๋ฐฉ๋ฒ•์€

 

@Entity(name = "`order`")

์œ„์™€ ๊ฐ™์ด ๋ฐฑํ‹ฑ(`)์œผ๋กœ ๊ฐ์‹ธ์ฃผ๋Š” ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•˜๋ฉด ์ •์ƒ์ ์œผ๋กœ ORDERํ…Œ์ด๋ธ”์ด ์ƒ์„ฑ๋˜๊ณ  ๋กœ๊ทธ์ƒ์˜ ์—๋Ÿฌ๋„ ์—†์–ด์ง„๋‹ค.

๋ฐ˜์‘ํ˜•
๋ฐ˜์‘ํ˜•
๊ณต์ง€์‚ฌํ•ญ
์ตœ๊ทผ์— ์˜ฌ๋ผ์˜จ ๊ธ€
์ตœ๊ทผ์— ๋‹ฌ๋ฆฐ ๋Œ“๊ธ€
Total
Today
Yesterday
๋งํฌ
ยซ   2026/01   ยป
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
๊ธ€ ๋ณด๊ด€ํ•จ