use of com.querydsl.sql.domain.Employee in project querydsl by querydsl.
the class BeanPopulationBase method populate_with_beanMapper.
@Test
public void populate_with_beanMapper() {
Employee employee = new Employee();
employee.setFirstname("John");
insert(e).populate(employee, new BeanMapper()).execute();
}
use of com.querydsl.sql.domain.Employee in project querydsl by querydsl.
the class SubqueriesBase method keys.
@Test
@ExcludeIn({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, SQLITE, SQLSERVER })
public void keys() {
QEmployee employee2 = new QEmployee("employee2");
ForeignKey<Employee> nameKey1 = new ForeignKey<Employee>(employee, ImmutableList.of(employee.firstname, employee.lastname), ImmutableList.of("a", "b"));
ForeignKey<Employee> nameKey2 = new ForeignKey<Employee>(employee, ImmutableList.of(employee.firstname, employee.lastname), ImmutableList.of("a", "b"));
query().from(employee).where(nameKey1.in(query().from(employee2).select(nameKey2.getProjection()))).select(employee.id).fetch();
}
use of com.querydsl.sql.domain.Employee in project querydsl by querydsl.
the class QBeanTest method alias_to_managed_type.
@Test
public void alias_to_managed_type() {
FactoryExpression<Employee> expr = Projections.bean(Employee.class, e.superiorId.as("id"));
Employee e = expr.newInstance(3);
assertEquals(3, e.getId().intValue());
}
use of com.querydsl.sql.domain.Employee in project querydsl by querydsl.
the class QBeanTest method alias_to_custom_type.
@Test
public void alias_to_custom_type() {
FactoryExpression<Employee> expr = Projections.bean(Employee.class, e.firstname.as("lastname"), e.lastname.as("firstname"));
Employee e = expr.newInstance("John", "Smith");
assertEquals("Smith", e.getFirstname());
assertEquals("John", e.getLastname());
}
use of com.querydsl.sql.domain.Employee in project querydsl by querydsl.
the class UnionBase method union_factoryExpression.
@SuppressWarnings("unchecked")
@Test
public void union_factoryExpression() {
SubQueryExpression<Employee> sq1 = query().from(employee).select(Projections.constructor(Employee.class, employee.id));
SubQueryExpression<Employee> sq2 = query().from(employee).select(Projections.constructor(Employee.class, employee.id));
List<Employee> employees = query().union(sq1, sq2).list();
for (Employee employee : employees) {
assertNotNull(employee);
}
}
Aggregations