}
@Test
public void CustomProjection() {
// Insert
Employee employee = new Employee();
employee.setFirstname("John");
Integer id = insert(e).populate(employee).executeWithKey(e.id);
employee.setId(id);
// Update
employee.setLastname("S");
assertEquals(1l, update(e).populate(employee).where(e.id.eq(employee.getId())).execute());
// Query
Employee smith = extQuery().from(e).where(e.lastname.eq("S"))
.limit(1)
.uniqueResult(Employee.class, e.lastname, e.firstname);
assertEquals("John", smith.getFirstname());
assertEquals("S", smith.getLastname());
// Query with alias
smith = extQuery().from(e).where(e.lastname.eq("S"))
.limit(1)
.uniqueResult(Employee.class, e.lastname.as("lastname"), e.firstname.as("firstname"));
assertEquals("John", smith.getFirstname());
assertEquals("S", smith.getLastname());
// Query into custom type
OtherEmployee other = extQuery().from(e).where(e.lastname.eq("S"))
.limit(1)
.uniqueResult(OtherEmployee.class, e.lastname, e.firstname);