@Override
    public boolean exists(final PasswordChangeRequest changeRequest) {
        val encodedPassword = encodePassword(changeRequest.toPassword());
        val query = SELECT_QUERY.concat("WHERE p.username = :username AND p.password = :password");
        return !this.entityManager.createQuery(query, JdbcPasswordHistoryEntity.class)
            .setParameter("username", changeRequest.getUsername())
            .setParameter("password", encodedPassword)
            .setMaxResults(1)
            .getResultList()
            .isEmpty();
    }
This is {@link JdbcPasswordHistoryService}.

@author Misagh Moayyed
@since 6.1.0
support/cas-server-support-pm-jdbc/src/main/java/org/apereo/cas/pm/jdbc/JdbcPasswordHistoryService.java