Search code examples
mysqlspring-bootannotations

What are the issues when not using @Column(columnDefinition = "TEXT")?


In my Board entity, there is a field.

private String content;

And, if i run the following query on my database(mysql),

ALTER TABLE board MODIFY content TEXT;

Will there be any issues du to the mismatch between the two? In my test, it seems like there are no problems. Do I not need to add @Column(columnDefinition = "TEXT") to the content field?

I’m wondering if there might be any issues I’m not aware of. Thanks


Solution

  • There should be no issues if your tests are passing and Hibernate is handling the mapping correctly. Adding @Column(columnDefinition = "TEXT") is not strictly necessary unless you want to explicitly declare the column type for clarity or control over the schema.