Annotation Type AssociationInverseSide
-
@Documented @Target({METHOD,FIELD}) @Retention(RUNTIME) @Repeatable(List.class) @PropertyMapping(processor=@PropertyMappingAnnotationProcessorRef(type=org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.impl.AssociationInverseSideProcessor.class,retrieval=CONSTRUCTOR)) public @interface AssociationInverseSide
Given an association from an entity typeA
to an entity typeB
, defines the inverse side of an association, i.e. the path fromB
toA
.This annotation is generally not needed, as inverse sides of associations should generally be inferred by the mapper. For example, Hibernate ORM defines inverse sides using
@OneToMany#mappedBy
,@OneToOne#mappedBy
, etc., and the Hibernate ORM mapper will register these inverse sides automatically.This annotation may be applied multiple times to the same property with different
extractions
, to configure a different association for different container elements. For example with a property of typeMap<Entity1, Entity2>
, one can have an association toEntity1
(map keys) orEntity2
(map values).
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description ObjectPath
inversePath
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description ContainerExtraction
extraction
-
-
-
Element Detail
-
inversePath
ObjectPath inversePath
- Returns:
- The path to the targeted entity on the inverse side of the association.
-
-
-
extraction
ContainerExtraction extraction
- Returns:
- A definition of container extractors to be applied to the property,
allowing the definition of the inverse side of an association modeled by container elements.
This is useful when the property is of container type,
for example a
Map<EntityA, EntityB>
: defining the extraction as@ContainerExtraction(BuiltinContainerExtractors.MAP_KEY)
allows referring to the association modeled by the map keys instead of the one modeled by the map values. By default, Hibernate Search will try to apply a set of extractors for common container types. - See Also:
ContainerExtraction
- Default:
- @org.hibernate.search.mapper.pojo.extractor.mapping.annotation.ContainerExtraction
-
-