All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avaje.ebean.annotation.DbArray Maven / Gradle / Ivy

There is a newer version: 8.1.1
Show newest version
package com.avaje.ebean.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 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:

*
{@code
 *
 * // Store as ARRAY of UUID on Postgres
 * @DbArray
 * List uids = new ArrayList<>();
 *
 * // Store as ARRAY on Postgres
 * @DbArray
 * List phoneNumbers = new ArrayList<>();
 *
 * // Store as ARRAY of INTEGER on Postgres
 * @DbArray
 * List someLongs = new ArrayList<>();
 *
 * }
*/ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface DbArray { /** * For VARCHAR storage specify the column length (defaults to 1000). */ int length() default 0; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy