Annotation Type ValueGenerationType

    public @interface ValueGenerationType
    Meta-annotation used to mark another annotation as providing configuration for a custom value generation strategy. This is the best way to work with customized value generation in Hibernate.

    For example, if we have a custom value generator:

     public class SKUGeneration
             implements BeforeExecutionGenerator {
         public SKUGeneration(SKU sku, Member annotatedMember,
                              GeneratorCreationContext context) {

    Then we may also define an annotation which associates this generator with a field or property of an entity and supplies configuration parameters:

     @ValueGenerationType(generatedBy = SKUGeneration.class)
     @Retention(RUNTIME) @Target({METHOD,FIELD})
     public @interface SKU {}

    and we may use it as follows:

     @SKU String sku;

    No more than one generator annotation may be placed on a given property.

    Adding a generator annotation to an entity property causes the value of the property to be generated when any SQL statement to insert or update the entity is executed.

    Every generator annotation type has an Generator implementation which is responsible for generating values. It must be either:

    A generator annotation may have members, which are used to configure the value generator, if either:

    There are several excellent examples of the use of this machinery right here in this package. TenantId and its corresponding generator TenantIdGeneration are a good place to start.

    A @ValueGenerationType annotation must have retention policy RetentionPolicy.RUNTIME.

    See Also:
    Generator, BeforeExecutionGenerator, OnExecutionGenerator, AnnotationBasedGenerator