接口 AssociationIntegrityAssuranceFilter<P extends Props>
- 类型参数:
P- Filtered type, it is often a type decorated by @MappedSuperclass.
- 所有超级接口:
Filter<P>
This interface should only be used by Java, kotlin developers can use `KAssociationIntegrityAssuranceFilter<E>`
The user's commitment to ensure that the filtered fields of two associated objects are the same.
Let's look at an example with the following defined entities:
@MappedSupperclass
public interface TenantAware {
String tenant()
}
@Entity
public interface Department extends TenantAware {
...
}
@Entity
public interface Employee extends TenantAware {
@ManyToOne
Department department(); // Nonnull many-to-one association
...
}
Here both Department and Employee support multi-tenancy, with a defined filter:
@Entity
public interface TenantAwareFilter extends AssociationIntegrityAssuranceFilter<TenantAwareProps> {
@Override
public void filter(FilterArgs<P> args) {
...
}
}
This filter implements the `AssociationIntegrityAssuranceFilter` interface.
This indicates the user's commitment that associated `Department` and `Employee` objects must belong to
the same tenant, `Department` and `Employee` objects belonging to different tenants will never be associated.
If the many-to-one association `Employee.department` could not be null without the filter,
then with this filter applied to both `Department` and `Employee` sides, this association also cannot be null.-
方法概要