且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Mysql数据库中避免'数据被截断'使用java?

更新时间:2021-12-11 00:38:19

就像错误是由于列 REPEAT_DAYS 太小而无法保存您通过 WeekdayType 传递的值> Enum。因此,请重新检查您的联合数据库中该列的定义,并最终增加它的大小。

Looks like the error is due the fact that the column REPEAT_DAYS is too small to save the values you're passing via the WeekdayType Enum. So recheck the definition of that column in your underling database and eventually increase it's size.

您还缺少一个注释:

 @Column(name="REPEAT_DAYS", length="45")
 @Enumerated(EnumType.STRING)
 private WeekdayType repeatDays;

注释中的长度应该与您的数据库架构中的列的长度。

The length in the annotation should match the length of your column in your DB schema.