A even better solution would be:

   @Override
    protected Account getAccount(final IdentityContext context, final UsernamePasswordCredentials credentials) {
        List<? extends Account> result = findByLoginName(context, SaleAgent.class, credentials.getUsername());

        if (result.isEmpty()) {
            return super.getAccount(context, credentials);
        }

        return result.get(0);
    }