use of com.querydsl.jpa.domain.QEmployee in project querydsl by querydsl.
the class SubQueryTest method innerJoin2.
@Test
public void innerJoin2() {
QEmployee employee = QEmployee.employee;
QUser user = QUser.user;
assertEquals("select employee\nfrom Employee employee\n inner join employee.user as user", selectFrom(employee).innerJoin(employee.user, user).toString());
}
use of com.querydsl.jpa.domain.QEmployee in project querydsl by querydsl.
the class JPACollectionAnyVisitorTest method simple_booleanOperation_elementCollection.
@Test
public void simple_booleanOperation_elementCollection() {
QEmployee employee = QEmployee.employee;
Predicate predicate = employee.jobFunctions.any().stringValue().eq("CODER");
assertEquals("exists (select 1\n" + "from Employee employee_1463394548\n" + " inner join employee_1463394548.jobFunctions as employee_jobFunctions_0\n" + "where employee_1463394548 = employee and str(employee_jobFunctions_0) = ?1)", serialize(predicate));
}
use of com.querydsl.jpa.domain.QEmployee in project querydsl by querydsl.
the class JPQLSerializerTest method delete_clause_uses_dELETE_fROM.
@Test
public void delete_clause_uses_dELETE_fROM() {
QEmployee employee = QEmployee.employee;
JPQLSerializer serializer = new JPQLSerializer(HQLTemplates.DEFAULT);
QueryMetadata md = new DefaultQueryMetadata();
md.addJoin(JoinType.DEFAULT, employee);
md.addWhere(employee.lastName.isNull());
serializer.serializeForDelete(md);
assertEquals("delete from Employee employee\nwhere employee.lastName is null", serializer.toString());
}
use of com.querydsl.jpa.domain.QEmployee in project querydsl by querydsl.
the class HibernateQueryTest method innerJoin.
@Test
public void innerJoin() {
HibernateQuery<?> hqlQuery = new HibernateQuery<Void>();
QEmployee employee = QEmployee.employee;
hqlQuery.from(employee);
hqlQuery.innerJoin(employee.user, QUser.user);
assertEquals("select employee\nfrom Employee employee\n inner join employee.user as user", hqlQuery.toString());
}
use of com.querydsl.jpa.domain.QEmployee 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