use of org.baeldung.entity.QPerson in project tutorials by eugenp.
the class PersonDaoImpl method findPersonsByFirstnameAndSurnameQueryDSL.
@Override
public List<Person> findPersonsByFirstnameAndSurnameQueryDSL(final String firstname, final String surname) {
final JPAQuery<Person> query = new JPAQuery<>(em);
final QPerson person = QPerson.person;
return query.from(person).where(person.firstname.eq(firstname).and(person.surname.eq(surname))).fetch();
}
use of org.baeldung.entity.QPerson in project tutorials by eugenp.
the class PersonDaoImpl method findPersonsByFirstnameInDescendingOrderQueryDSL.
@Override
public List<Person> findPersonsByFirstnameInDescendingOrderQueryDSL(final String firstname) {
final JPAQuery<Person> query = new JPAQuery<>(em);
final QPerson person = QPerson.person;
return query.from(person).where(person.firstname.eq(firstname)).orderBy(person.surname.desc()).fetch();
}
use of org.baeldung.entity.QPerson in project tutorials by eugenp.
the class PersonDaoImpl method findMaxAge.
@Override
public int findMaxAge() {
final JPAQuery<Person> query = new JPAQuery<>(em);
final QPerson person = QPerson.person;
return query.from(person).select(person.age.max()).fetchFirst();
}
use of org.baeldung.entity.QPerson in project tutorials by eugenp.
the class PersonDaoImpl method findPersonsByFirstnameQueryDSL.
@Override
public List<Person> findPersonsByFirstnameQueryDSL(final String firstname) {
final JPAQuery<Person> query = new JPAQuery<>(em);
final QPerson person = QPerson.person;
return query.from(person).where(person.firstname.eq(firstname)).fetch();
}
use of org.baeldung.entity.QPerson in project tutorials by eugenp.
the class PersonDaoImpl method findMaxAgeByName.
@Override
public Map<String, Integer> findMaxAgeByName() {
final JPAQuery<Person> query = new JPAQuery<>(em);
final QPerson person = QPerson.person;
return query.from(person).transform(GroupBy.groupBy(person.firstname).as(GroupBy.max(person.age)));
}