HibernateSqlRequest { public HibernateSqlRequest<T> addEntity(Class<?> entityType) { return addEntity(null, entityType); } private  HibernateSqlRequest(String query); HibernateSqlRequest<T> p(String name, Object val); HibernateSqlRequest<T> p(String name, Object... vals); HibernateSqlRequest<T> maxResults(int maxResults); HibernateSqlRequest<T> transform(Class<?> clazz); HibernateSqlRequest<T> useTransformer(ResultTransformer transformer); T first(); List<T> list(); int count(); HibernateSqlRequest<T> addEntity(Class<?> entityType); HibernateSqlRequest<T> addEntity(String tableAlias, Class<?> entityType); HibernateSqlRequest<T> addJoin(String tableAlias, String path); HibernateSqlRequest<T> addJoin(String tableAlias, String ownerTableAlias,
            String joinPropertyName); static HibernateSqlRequest<T> create(String query);  }
@Test public void addEntity() { String sql = "select f_pid, f_login, fk_department from users u"; List<User> users = H.<User> sqlRequest(sql).addEntity(User.class).list(); assertThat(users).hasSize(2).extracting("login").containsOnly("login_a", "login_b"); assertThat(users).extracting("pid").doesNotContainNull(); assertThat(users).extracting("department.name").containsOnly("department_a", "department_b"); }