Search code examples
javaspringspring-boothibernate

Data truncation: Data too long for column 'params' at row 7


In my project I was using old Java and Spring version, so I had to update them. I've also updated some old dependencies. Now when I start to run the application I got this error:

Error executing DDL "alter table activity_log modify column params tinytext" via JDBC [Data truncation: Data too long for column 'params' at row 7]

This error applies to all entities where I'm using the @Lob annotation.

Here is one of the classes:

@Getter
@Setter
@Entity
public class ActivityLog extends AdditionalAbstractAuditable<Long> {

    private String eventName;

    @Lob
    private String params;

    @Embedded
    private ActivityParamsId activityParamsId;
}

What could be the solution?


Solution

  • Change:

    @Lob
    private String params;
    

    Into:

    @Lob
    @Column(columnDefinition = "LONGTEXT")
    private String params;