I am working under a project that is update the data's in MySQL table using Hibernate. Whenever I run the project, the exception is shown as below.
[Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1]
Controller
@RequestMapping(value = "/disableEmployeeMaster", method = RequestMethod.POST)
public @ResponseBody void disableEmployee(HttpServletRequest request)
{
EmployeeMaster employeeMaster = new EmployeeMaster();
try
{
String employeeId = request.getParameter("employeeId");
employeeMaster.setIsDel("Y");
mainService.disableEmployee(employeeId , employeeMaster);
}
catch(Exception e)
{
logger.error(e.getMessage());
}
}
Service Implementation
@Override
public void disableEmployee(String Id, EmployeeMaster employeeMaster) {
Session session = null;
Transaction transaction = null;
try
{
session = sessionFactory.openSession();
transaction = session.beginTransaction();
session.update(Id, employeeMaster);
transaction.commit();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
finally
{
session.close();
}
}