신규 habit을 등록되지 않는 오류가 있었고, 최대 길이 제한이 너무 작아서 발생한 문제였다.
기존 Habit Entity Code
private String body;
private String bodyHtml;
변경 Habit Entity Code
@Column(length = 50000)
private String body;
@Column(length = 50000)
private String bodyHtml;
<aside> ⚠️ body 칼럼의 최대길이는 16383 입니다. BLOB 이나 TEXT 타입을 사용하세요.
</aside>
2023-02-01 03:12:07.858 WARN 26640 --- [ main] o.h.t.s.i.ExceptionHandlerLoggedImpl : GenerationTarget encountered exception accepting command : Error executing DDL "
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "
create table habit (
habit_id bigint not null auto_increment,
created_at datetime,
last_modified_at datetime,
auth_end_time time,
auth_start_time time,
auth_type varchar(255),
avg_score double precision,
body varchar(60000),
body_html varchar(60000),
challengers integer,
fail_img_url varchar(255),
sub_title varchar(255),
succ_img_url varchar(255),
thumb_img_url varchar(255),
title varchar(255),
category_id bigint,
user_id bigint,
primary key (habit_id)
) engine=InnoDB" via JDBC Statement
...
Caused by: java.sql.SQLSyntaxErrorException: Column length too big for column 'body' (max = 16383); use BLOB or TEXT instead
해결 방법 1
yerim@ip:~$ mysql --version
mysql Ver 8.0.32-0ubuntu0.20.04.2 for Linux on x86_64 ((Ubuntu))
해결방법 2
VARCHAR 말고 TEXT나 BLOB 타입을 주는 것.
@Lob
private String body;
@Lob
private String bodyHtml;
잘 실행 되었다.