【发布时间】:2022-01-13 10:17:51
【问题描述】:
我正在使用 spring-boot 和 JPA 这是我用于列表的字段
@ElementCollection
@Column(columnDefinition="TEXT")
@CollectionTable(name="general_values")
private List<String> values;
但我收到错误
Caused by: org.postgresql.util.PSQLException: ERROR: value too long for type character varying(255)
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440) ~[postgresql-42.2.5.jar:42.2.5]
但是在value 的数据库表类型中显示为文本。由于我使用TEXT 作为类型并且在表格列中也显示为text,但错误仍然是varying(255).
以及值字段的请求负载
"values":["45","There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable"]
【问题讨论】:
标签: java spring spring-boot spring-data-jpa