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 type
A
to an entity type B
,
defines the inverse side of an association,
i.e. the path from B
to A
.
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 type Map<Entity1, Entity2>
,
one can have an association to Entity1
(map keys) or Entity2
(map values).
-
Nested Class Summary
Nested Classes -
Required Element Summary
Required Elements -
Optional Element Summary
Optional Elements
-
Element Details
-
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:
- Default:
- @org.hibernate.search.mapper.pojo.extractor.mapping.annotation.ContainerExtraction
-