micronautmicronaut-data

Micronaut Data JDBC and Postgres Arrays


Do you know if Micronaut Data JDBC supports Postgres array using Java array/collections or do I need to define a custom type? If so how? I looked at https://micronaut-projects.github.io/micronaut-data/latest/guide/#jdbcDataTypes but did not see any information on array types.


Solution

  • Looks like array types does not work out of the box unless you specify the column data type as DataType.OBJECT e.g.

    @MappedEntity
    public class Article{
      //...
      @MappedProperty(type = DataType.OBJECT)
      private String[] labels;
    }