public List<Client> findClientByAssociateUser(String userId) {
logger.info("Enter find list of clients by this user");
org.hibernate.Query query = sessionFactory.getCurrentSession()
.createQuery("SELECT c.id, c.clientName, c.billingAddress,c.contactNumber"
+ " from Client c, User ud"
+ " WHERE ud.id = c.userId and ud.id = :id")
.setString("id", userId);
List<Client> result = (List<Client>) query.list();
logger.info("Exit find list of clients");
return result;
}
public ModelAndView userDetails(@PathVariable String id, HttpServletRequest request) {
ModelAndView mvc = new ModelAndView();
List<Client> clientList = userRepository.findClientByAssociateUser(id.toString());
mvc.addObject("clientList", clientList);
for (Client client : clientList) {
System.out.println("Client Name{" + client.getClientName());
}
mvc.setViewName(MANAGEUSER_PREFIX + "details");
return mvc;
}
我正进入(状态:
Ljava.lang.Object; cannot be cast to Client