这篇文章上次修改于 2020 天前,可能其部分内容已经发生变化,如有疑问可询问作者。 > Caused by: org.h2.jdbc.JdbcSQLDataException: Value too long for column """BRIEF"" VARCHAR(255) ,h2 生成的默认长度是255 [1]报错如下: ```bash Caused by: org.h2.jdbc.JdbcSQLDataException: Value too long for column """BRIEF"" VARCHAR(255)": "STRINGDECODE('\uff1aDuenpatra\uff08pim\uff09\u5728\u5979\u7684\u7956\u6bcd\u4f4f\u5b85\u7684Prapim\u5f00\u4e86\u4e00\u5bb6\u81ea... (320)"; SQL statement: replace INTO my_season (actors, brief, cat, cover, finish, pinyin, plays, rating, score, season_no, title, title_en, year, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [22001-199] at org.h2.message.DbException.getJdbcSQLException(DbException.java:455) ~[h2-1.4.199.jar:1.4.199] at org.h2.message.DbException.getJdbcSQLException(DbException.java:427) ~[h2-1.4.199.jar:1.4.199] at org.h2.message.DbException.get(DbException.java:205) ~[h2-1.4.199.jar:1.4.199] at org.h2.table.Column.validateConvertUpdateSequence(Column.java:441) ~[h2-1.4.199.jar:1.4.199] at org.h2.table.Table.validateConvertUpdateSequence(Table.java:824) ~[h2-1.4.199.jar:1.4.199] at org.h2.command.dml.Insert.insertRows(Insert.java:175) ~[h2-1.4.199.jar:1.4.199] at org.h2.command.dml.Insert.update(Insert.java:132) ~[h2-1.4.199.jar:1.4.199] at org.h2.command.CommandContainer.update(CommandContainer.java:133) ~[h2-1.4.199.jar:1.4.199] at org.h2.command.Command.executeUpdate(Command.java:267) ~[h2-1.4.199.jar:1.4.199] at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:200) ~[h2-1.4.199.jar:1.4.199] at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:154) ~[h2-1.4.199.jar:1.4.199] at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61) ~[HikariCP-3.2.0.jar:na] at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java) ~[HikariCP-3.2.0.jar:na] at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:175) ~[hibernate-core-5.3.9.Final.jar:5.3.9.Final] ... 89 common frames omitted ``` [2]解决办法,加上下面的声明,注意如果是内存中,需要重启,如果文件中,需要删除重新运行 ```java @Column(length = 2000) private String brief; ``` [3]或者 ```java @Column(columnDefinition = "TEXT") private String brief; ```
没有评论