Package org.hibernate.annotations

Annotation Type GeneratorType


  • @Retention(RUNTIME)@Target({FIELD,METHOD})@Deprecated(since="6.0")public @interfaceGeneratorType
    Deprecated.
    ValueGenerationType andAnnotationValueGeneration now provide a much more powerful and typesafe alternative
    Marks a field or property of an entity as automatically generated by code written in Java, before any SQL statement toinsert orupdate the entity is executed, specifying an implementation ofValueGenerator used for generating its values.

    It is the responsibility of the client to ensure that a specifiedgenerator type produces values which are assignable to the annotated property.

    This annotation is only useful for values generated in the Java code, and it is not used for generating the values of entity identifiers:

    • For identifier generators, useGenericGenerator orIdGeneratorType.
    • If the value of a field or property is generated by the database when aninsert orupdate statement is executed, use theGenerated annotation.
    • Optional Element Summary

      Optional Elements 
      Modifier and TypeOptional ElementDescription
      GenerationTimewhen
      Deprecated.
      Specifies when values should be generated: IfGenerationTime.INSERT, the value will be generated before each SQLinsert statement is executed.
      • when

        GenerationTime when
        Deprecated.
        Specifies when values should be generated:
        Default:
        org.hibernate.annotations.GenerationTime.ALWAYS