数据插入数据库的时候报错, 但是数据库里面字段长度就不是1的


Caused by: org.postgresql.util.PSQLException: ERROR: value too long for type character(1)
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2155)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:288)
    at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:430)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:356)
    at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:168)
    at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:135)
    at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:98)
    at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:98)
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:133)
    ... 108 common frames omitted

Caused by: org.postgresql.util.PSQLException: ERROR: value too long for type character(1)
既然报错了,就说明字段的值大于字段定义的最大范围。
你将报错的字段类型范围加大试试看。

你数据库的表肯定不止一列吧, 你看看是不是你插入的时候没有对应好。

把表展示出来啊我的天

先把字段长度1, 改成100, 运行成功后,你去看看数据长度,到底是多少。