001package io.ebean.annotation; 002 003import java.lang.annotation.ElementType; 004import java.lang.annotation.Retention; 005import java.lang.annotation.RetentionPolicy; 006import java.lang.annotation.Target; 007 008/** 009 * Defines identity generation for an associated entity bean. 010 */ 011@Retention(RetentionPolicy.RUNTIME) 012@Target({ElementType.FIELD, ElementType.TYPE}) 013public @interface Identity { 014 015 /** 016 * The type of identity for the associated entity bean. 017 */ 018 IdentityType type() default IdentityType.AUTO; 019 020 /** 021 * For IDENTITY type specify the generated mode of ALWAYS or BY DEFAULT. 022 */ 023 IdentityGenerated generated() default IdentityGenerated.AUTO; 024 025 /** 026 * Sequence name when using type SEQUENCE. When not specified the 027 * naming convention will define the sequence name. 028 */ 029 String sequenceName() default ""; 030 031 /** 032 * Optional START WITH value of an IDENTITY or SEQUENCE. 033 */ 034 int start() default 0; 035 036 /** 037 * Optional INCREMENT BY value of an IDENTITY or SEQUENCE. 038 */ 039 int increment() default 0; 040 041 /** 042 * Optional CACHE option for database IDENTITY or SEQUENCE. 043 * <p> 044 * Used by some databases for a performance improvement providing identity 045 * and sequence values with the potential for gaps and non strict ordering 046 * of values being used. 047 */ 048 int cache() default 0; 049}