use of com.querydsl.jpa.domain.QCompany in project querydsl by querydsl.
the class AbstractSQLTest method entityQueries7.
@Test
public void entityQueries7() {
QCompany company = QCompany.company;
assertEquals(Arrays.asList(), query().from(company).select(company.officialName).fetch());
}
use of com.querydsl.jpa.domain.QCompany in project querydsl by querydsl.
the class JPACollectionAnyVisitorTest method nested_any_booleanOperation.
@Test
public void nested_any_booleanOperation() {
QCompany company = QCompany.company;
Predicate predicate = company.departments.any().employees.any().firstName.eq("Bob");
assertEquals("exists (select 1\n" + "from company.departments as company_departments_0\n" + " inner join company_departments_0.employees as company_departments_0_employees_1\n" + "where company_departments_0_employees_1.firstName = ?1)", serialize(predicate));
}
use of com.querydsl.jpa.domain.QCompany in project querydsl by querydsl.
the class JPAQueryMixinTest method orderBy_nonRoot_twice.
@Test
public void orderBy_nonRoot_twice() {
QDepartment department = QDepartment.department;
QCompany departmentCompany = new QCompany("department_company");
QEmployee departmentCompanyCeo = new QEmployee("department_company_ceo");
mixin.from(department);
mixin.orderBy(department.company.ceo.firstName.asc(), department.company.ceo.lastName.asc());
QueryMetadata md = mixin.getMetadata();
assertEquals(Arrays.asList(new JoinExpression(JoinType.DEFAULT, department), new JoinExpression(JoinType.LEFTJOIN, department.company.as(departmentCompany)), new JoinExpression(JoinType.LEFTJOIN, departmentCompany.ceo.as(departmentCompanyCeo))), md.getJoins());
assertEquals(Arrays.asList(departmentCompanyCeo.firstName.asc(), departmentCompanyCeo.lastName.asc()), md.getOrderBy());
}
Aggregations