The solution

Each class that implements Validator has a crossEntityValidation method where you must place any logic which validates the value in your entity against data on other entities.

If cross-field validation has succeeded, then the persistence infrastructure automatically calls crossEntityValidation after any insert or modify operation (but not after a physical remove operation), and fails the operation if any validation errors have been raised. The persistence infrastructure permits database access occurring during crossEntityValidation, so that your validation logic can retrieve data on other entities required to implement the validation.