Вызвано: psqlexception: ошибка: столбец "ColumnName" имеет тип текст [], но выражение зависит от типа символаJAVA

Программисты JAVA общаются здесь
Anonymous
Вызвано: psqlexception: ошибка: столбец "ColumnName" имеет тип текст [], но выражение зависит от типа символа

Сообщение Anonymous »

Caused by: org.postgresql.util.PSQLException: ERROR: column "columnName" is of type text[] but expression is of type character varying
Hint: You will need to rewrite or cast the expression.
Position: 433
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2713)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2401)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:368)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:498)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:415)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:190)
at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:152)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:275)
... 59 more
< /code>
DB Столбец: < /p>
@Convert(converter = StringArrayConverter.class)
@Column(name = "columnName", columnDefinition = "text[]")
private String[] gvcBrands = new String[0];
< /code>
class class: < /p>
package com.coral.epos2.customers.model;

import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;

@Converter(autoApply = true)
public class StringArrayConverter implements AttributeConverter {

@Override
public String convertToDatabaseColumn(String[] attribute) {

}

@Override
public String[] convertToEntityAttribute(String dbData) {

}
}
< /code>
Я получаю выше ошибки, когда мы хотим вставить данные в DB. Пожалуйста, помогите мне написать правильный класс конвертера.

Подробнее здесь: https://stackoverflow.com/questions/794 ... -but-expre

Вернуться в «JAVA»