@Override
public List<E> findBy(E example, SingularAttribute<E, ?>... attributes) {
String jpqlQuery = allQuery() + " where ";
List<String> names = extractPropertyNames(attributes);
List<Property<Object>> properties = PropertyQueries.createQuery(entityClass)
.addCriteria(new NamedPropertyCriteria(names.toArray(new String[] {}))).getResultList();
jpqlQuery += prepareWhere(properties);
log.debugv("findBy: Created query {0}", jpqlQuery);
TypedQuery<E> query = entityManager.createQuery(jpqlQuery, entityClass);
addParameters(query, example, properties);
return query.getResultList();