Annotation Interface Link
Mark a soft reference (contextId) field as linked to another repository domain class. Doing so
facilitates fetch criteria targeting fields from the related domain that were hydrated into a
projection. This is a query optimization and allows criteria to extend into the related domain.
This does not, however, facilitate fetch hydration of those related fields into the projection.
That hydration step is still primarily performed via
HydrationUtility
.
Link
is always used in combination with FilterAndSortAlias
.
@FilterAndSortAlias
provides the mapping to the property in the projection that contains
the richer structure that is hydrated with filterable properties referencing this linked entity.
For example, CategoryProduct
contains this structure:
public class CategoryProduct implements Serializable, ContextStateAware, Sorted { ... private ProductRef product; ... }In this case, the
product
field contains the ProductRef
structure, which is a
semi-rich representation of Product
. As a result, it may be that filter criteria is
requested against fields in ProductRef. The @Link
and @FilterAndSortAlias
annotations would therefore look like the following in JpaCategoryProduct
:
public class JpaCategoryProduct implements Serializable, Trackable, ModelMapperMappable, BusinessTypeAware, Sortable { ... @Indexed
@Link(value = JpaProduct.class)
@FilterAndSortAlias("product")
private String productContextId; ... }
- Author:
- Jeff Fischer
-
Required Element Summary