I am working on Spring/Hibernate sample web application. Actually, I am trying to load the employees from database. In this case, while getting the data from database for both employee and address tables i am getting the NumberFormat exception.
Following is the code i am working on,
JSP Code:
<c:if test="${!empty employeeList}">
<table class="data">
<c:forEach items="${employeeList}" var="emp">
<tr>
<td><c:out value="${emp.firstname}" /></td>
<td><c:out value="${emp.lastname}" /></td>
<td><c:out value="${emp.email}" /></td>
<td><a href="edit/${emp.id}">Edit</a></td>
<td><a href="delete/${emp.id}">Delete</a></td>
</tr>
</c:forEach>
Controller Code:
@RequestMapping(value = "/", method = RequestMethod.GET)
public String listEmployees(ModelMap map)
{
map.addAttribute("employeeList", employeeManager.getAllEmployees());
return "editEmployeeList";
}
Service Layer Code:
@Override
@Transactional
public List<EmployeeEnitity> getAllEmployees() {
return employeeDAO.getAllEmployees();
}
public List<EmployeeEntity> getAllEmployees() {
return this.sessionFactory.getCurrentSession().createQuery("select ee.firstname,ee.lastname,addr.email from " +
"com.howtodoinjava.entity.EmployeeEntity ee, com.howtodoinjava.entity.AddressEntity addr where ee.id=addr.id").list();
}
Please help me to resolve this exception
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…