com.avaje.ebean.annotation.DbJson Maven / Gradle / Ivy
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 property holding JSON content.
*
* By default the content will be stored in a DB Clob except on Postgres where DB JSON type is used.
*
* Example:
* {@code
*
* // Store as JSON on Postgres or Clob on other databases
* @DbJson
* Map content;
*
* }
*
* Example with JSONB storage
* {@code
*
* // Store as JSONB on Postgres or Clob on other databases
* @DbJson(storage = DbJsonType.JSONB)
* Map content;
*
* }
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface DbJson {
/**
* Specify the database type used to store the JSON content.
*/
DbJsonType storage() default DbJsonType.JSON;
/**
* For VARCHAR storage specify the column length (defaults to 3000).
*/
int length() default 0;
}