Spring Boot 3 - Convert from text[] column to List<String> attribute

31 Views Asked by At

I am trying to convert database column of type text[] to Entity attribute of type List<String> in Spring Boot 3.2.3, Hibernate 6.4.4.

I tried setting it like this:

@Type(ListArrayType.class)
@Column(columnDefinition = "text[]")
@Basic() // was used here in Spring Boot 2 as well
private List<String> myColumn = new ArrayList<>();

After that, I get the following error:
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [my_column] in table [my_table]; found [_text (Types#ARRAY)], but expecting [text[] (Types#OTHER)]

My PostgreSQL database column definition:
my_column text[] COLLATE pg_catalog."default" DEFAULT '{someValue}'::text[],

Used hypersistence library:

<dependency>
  <groupId>io.hypersistence</groupId>
  <artifactId>hypersistence-utils-hibernate-63</artifactId>
  <version>3.7.3</version>
</dependency>

Any suggestions please, what am I doing wrong?

0

There are 0 best solutions below