我的dao课程在
之下@Override
public List<PersonDTO> getAllEmployees(long companyId) {
Query query = getCurrentSession().getNamedQuery(User.class.getName() + ".getAllEmployee");
query.setParameter("companyId", companyId);
query.setResultTransformer(Transformers.aliasToBean(PersonDTO.class));
return query.list();
}
我的服务类位于
之下public List<PersonDTO> getAllEmployees(long companyId) {
try {
return userDAO.getAllEmployees(companyId);
} catch (Exception e) {
throw new ApplicationException(e);
}
}
我有嵌入式课程
public class EntityListResponce implements Serializable {
private static final long serialVersionUID = 1L;
private List<PersonDTO> personDTO;
public List<PersonDTO> getPersonDTO() {
return PersonDTO;
}
public void setPersonDTO(List<PersonDTO> employeesList) {
this.PersonDTO = employeesList;
}
}
我写了一个像下面这样的控制器。
@RequestMapping("/getAllEntitys.htm")
public void getAllEntities(HttpServletRequest request, HttpServletResponse response) {
try {
ZSession zSession = getZSession(request);
Long companyId = zSession.getCompanyId();
EntityListResponce entityListResponce = new EntityListResponce();
List<PersonDTO> employeesList = personService.getAllEmployees(companyId);
WebUtils.writeJSONResponse(response,
getSerializer(request, EXCLUDE_FILES).deepSerialize(entityListResponce));
} catch (Exception e) {
writeException(request, response, e);
}
}
}
是否像这样收集所有employeesList的正确方法
List<PersonDTO> employeesList = personService.getAllEmployees(companyId);
我没有得到所有的employeesList作为回应。