Annotation Type DbArray


@Retention(RUNTIME) @Target(FIELD) public @interface DbArray
Specify a collection property that will be stored into a DB ARRAY type.

If the target database does not support ARRAY type (so not Postgres) then the collection will be stored in JSON format into a VARCHAR column.

Example:



 // Store as ARRAY of UUID on Postgres
 @DbArray
 List<UUID> uids = new ArrayList<>();

 // Store as ARRAY on Postgres
 @DbArray
 List<String> phoneNumbers = new ArrayList<>();

 // Store as ARRAY of INTEGER on Postgres
 @DbArray
 List<Long> someLongs = new ArrayList<>();

 
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    int
    For VARCHAR storage specify the column length (defaults to 1000).
    The name of the column (Optional).
  • Element Details

    • name

      String name
      The name of the column (Optional).
      Default:
      ""
    • length

      int length
      For VARCHAR storage specify the column length (defaults to 1000).
      Default:
      0