This is an internal documentation. There is a good chance you’re looking for something else. See Disclaimer.

Automatically generated values

For data types whose values should be created or updated automatically a FieldGenerator can be contributed. The value of these fields are automatically created when a entity is inserted and/or updated. The FieldGenerator returns a GenerationTiming (defines if the value should be generated when the entity is created or when it is updated) and a supplier which generates the value.

The field generators are stored in the ContributionClassLoaderService so that they can be accessed through the session later on.

If a field generator exists for a given data type, the AlwaysGeneratedValue annotation is added to this field (or the InsertGeneratedValue if the value should only be generated once when the entity is first created). Both annotations take the data type as a mandatory parameter (see Generated fields).

These annotations are themselves annotated with Hibernate’s ValueGenerationType annotation (see documentation). The ValueGenerationType annotations refer to an implementation of AbstractFieldGeneration which looks up the correct FieldGenerator in the session (depending on the data type) and generates the value.