public static Specification<JpaTarget> hasNotDistributionSetInActions(final Long distributionSetId) {
        return (targetRoot, query, cb) -> {
            final ListJoin<JpaTarget, JpaAction> actionsJoin = targetRoot.join(JpaTarget_.actions, JoinType.LEFT);
            actionsJoin.on(cb.equal(actionsJoin.get(JpaAction_.distributionSet).get(JpaDistributionSet_.id),
                    distributionSetId));

            return cb.isNull(actionsJoin.get(JpaAction_.id));
        };
    }
public static Specification < JpaTarget > hasNotDistributionSetInActions ( final Long distributionSetId ) { return ( targetRoot , query , cb ) -> { final ListJoin < JpaTarget , JpaAction > actionsJoin = targetRoot . join ( JpaTarget_ . actions , JoinType . LEFT ) ; actionsJoin . on ( cb . equal ( actionsJoin . get ( JpaAction_ . distributionSet ) . get ( JpaDistributionSet_ . id ) , distributionSetId ) ) ; return cb . isNull ( actionsJoin . get ( JpaAction_ . id ) ) ; } ; }
{@link Specification} for retrieving {@link Target}s that don't have the
given distribution set in their action history

@param distributionSetId
the ID of the distribution set which must not be assigned
@return the {@link Target} {@link Specification}