@Retention(CLASS) @Target({FIELD})

public @interface GeneratedValue

Overrides the legacy Id.autoIncrement strategy for this identifier.

Methods

public abstract GenerationType strategy() default GenerationType.IDENTITYChooses identifier generation, overriding Id.autoIncrement.
public abstract String generator() default ""Names the counter used by SEQUENCE or TABLE generation.

Method details

strategy

public abstract GenerationType strategy() default GenerationType.IDENTITY
Chooses identifier generation, overriding Id.autoIncrement. Generated composite identifiers are not supported.

Returns

generation strategy; IDENTITY by default

generator

public abstract String generator() default ""
Names the counter used by SEQUENCE or TABLE generation.

Returns

counter name; empty derives a name from the table and key column