Annotation Interface ConverterRegistration
AttributeConverter. The main
purpose is to be able to control Converter.autoApply()
external to the actual converter class, which might be useful for third-parties
converters.
Registrations applied to a package-info.java or module-info.java
are processed before Hibernate begins to process any attributes, etc.
Registrations applied to a class are only applied once Hibernate begins to process that class; it will also affect all future processing. However, it will not change previous resolutions to use this newly registered one. Due to this nondeterminism, it is recommended to only apply registrations to packages or modules.
-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionClass<? extends AttributeConverter<?, ?>> The converter class to register -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanShould the registered converter be auto applied for converting values of its reported domain type?Class<?> The domain type to which this converter should be applied.
-
Element Details
-
converter
Class<? extends AttributeConverter<?,?>> converterThe converter class to register -
domainType
Class<?> domainTypeThe domain type to which this converter should be applied. This allows refining the domain type associated with the converter e.g. to apply to a subtype.With
autoApply()set to true, this will effectively override converters defined withConverter.autoApply()set tofalseand auto-apply them.With
autoApply()set to false, this will effectively override converters defined withConverter.autoApply()set totrueand disable auto-apply for them.- Default:
void.class
-
autoApply
boolean autoApplyShould the registered converter be auto applied for converting values of its reported domain type?Defaults to true as that is the more common use case for this annotation.
- Default:
true
-