Package org.hibernate.annotations
Annotation Type Any
-
@Target({METHOD,FIELD}) @Retention(RUNTIME) public @interface Any
Maps a discriminated to-one style associations pointing to one of several entity types depending on a local discriminator, as opposed to discriminated inheritance where the discriminator is kept as part of the entity hierarchy (seeInheritanceandInheritanceType.SINGLE_TABLEfor details about discriminated inheritance mappings). For example, if you consider an Order entity containing Payment information where Payment might be of type CashPayment or CreditCardPayment the @Any approach would be to keep that discriminator and matching value on the Order itself. Thought of another way, the "foreign-key" really is made up of the value and discriminator. UseColumnorFormulato define the "column" to which the discriminator is mapped. UseJoinColumnto describe the key column UseAnyDiscriminator,JdbcTypeorJdbcTypeCodeto describe the mapping for the discriminator UseAnyKeyJavaType,AnyKeyJavaClass,AnyKeyJdbcTypeorAnyKeyJdbcTypeCodeto describe the mapping for the key UseAnyDiscriminatorValuesto specify the discriminator<->entity mappings- See Also:
ManyToAny
-
-
Element Detail
-
fetch
FetchType fetch
Defines whether the value of the field or property should be lazily loaded or must be eagerly fetched. The EAGER strategy is a requirement on the persistence provider runtime that the value must be eagerly fetched. The LAZY strategy is applied when bytecode enhancement is used. If not specified, defaults to EAGER.- Default:
- jakarta.persistence.FetchType.EAGER
-
-